文件下载名称调优
This commit is contained in:
1 parent
cd5aa624db
commit
0e02d446ba
19 files changed
+116
-37
No files matched your search
@@ -3,6 +3,7 @@ using Jiaowu.Api.Domain.Academic;
|
||||
using Jiaowu.Api.Domain.Identity;
|
||||
using Jiaowu.Api.Infrastructure.Auth;
|
||||
using Jiaowu.Api.Infrastructure.Excel;
|
||||
using Jiaowu.Api.Infrastructure.Files;
|
||||
using Jiaowu.Api.Infrastructure.Persistence;
|
||||
using Jiaowu.Api.Infrastructure.OfficialDocuments;
|
||||
using Jiaowu.Api.Infrastructure.Timetables;
|
||||
@@ -168,8 +169,7 @@ public sealed class TimetableManagementController(
|
||||
cancellationToken);
|
||||
if (result.Result is null) return result.Error!;
|
||||
var bytes = TimetableExcelExporter.Create(result.Result);
|
||||
var fileName =
|
||||
$"{FileName(result.Result.Subject.Name)}-{FileName(result.Result.Term.Name)}-课表.xlsx";
|
||||
var fileName = DownloadFileName.Export("课表", ".xlsx", result.Result.Subject.Name, result.Result.Term.Name);
|
||||
return File(bytes, ExcelWorkbookHelper.ContentType, fileName);
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ public sealed class TimetableManagementController(
|
||||
}
|
||||
|
||||
var bytes = TimetableExcelExporter.Create(timetables);
|
||||
var fileName = $"课表批量导出-{FileName(timetables[0].Term.Name)}.xlsx";
|
||||
var fileName = DownloadFileName.Export("课表批量导出", ".xlsx", timetables[0].Term.Name);
|
||||
return File(bytes, ExcelWorkbookHelper.ContentType, fileName);
|
||||
}
|
||||
|
||||
@@ -240,7 +240,7 @@ public sealed class TimetableManagementController(
|
||||
timetables.Add(result.Result);
|
||||
}
|
||||
|
||||
var fileName = $"课表批量导出-{FileName(timetables[0].Term.Name)}.pdf";
|
||||
var fileName = DownloadFileName.Export("课表批量导出", ".pdf", timetables[0].Term.Name);
|
||||
return File(TimetablePdfExporter.Create(timetables, officialDocumentOptions.FontPath), "application/pdf", fileName);
|
||||
}
|
||||
|
||||
@@ -259,7 +259,7 @@ public sealed class TimetableManagementController(
|
||||
.Select(x => new object?[] { "教学楼空余教室", x.Name, "/venue-display/building/" + x.Id })
|
||||
.ToListAsync(cancellationToken);
|
||||
var bytes = ExcelWorkbookHelper.Create("展牌链接", ["展牌类型", "场地", "相对链接"], classrooms.Concat(buildings).ToList());
|
||||
return File(bytes, ExcelWorkbookHelper.ContentType, "场地信息展牌链接.xlsx");
|
||||
return File(bytes, ExcelWorkbookHelper.ContentType, DownloadFileName.Export("场地信息展牌链接", ".xlsx"));
|
||||
}
|
||||
|
||||
private async Task<(TimetableData? Result, ActionResult? Error)> LoadAuthorizedAsync(
|
||||
@@ -301,7 +301,7 @@ public sealed class TimetableManagementController(
|
||||
File(
|
||||
TimetablePdfExporter.Create(timetable, officialDocumentOptions.FontPath),
|
||||
"application/pdf",
|
||||
$"{FileName(timetable.Subject.Name)}-{FileName(timetable.Term.Name)}-课表.pdf");
|
||||
DownloadFileName.Export("课表", ".pdf", timetable.Subject.Name, timetable.Term.Name));
|
||||
}
|
||||
|
||||
public sealed record TimetableBatchExportRequest(
|
||||
|
||||
Reference in new issue
Block a user