文件下载名称调优

This commit is contained in:
biss committed 2026-08-21 17:34:22 +08:00
1 parent cd5aa624db
commit 0e02d446ba
19 files changed
+116 -37

No files matched your search

@@ -4,6 +4,7 @@ using Jiaowu.Api.Infrastructure.Auth;
using Jiaowu.Api.Infrastructure.Caching;
using Jiaowu.Api.Infrastructure.Academic;
using Jiaowu.Api.Infrastructure.Excel;
using Jiaowu.Api.Infrastructure.Files;
using Jiaowu.Api.Infrastructure.Persistence;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@@ -74,7 +75,7 @@ public sealed class PersonnelExcelController(
"整批数据会先校验,任一行有误时均不会写入。"
]);
return File(bytes, ExcelWorkbookHelper.ContentType,
$"{RegistryName(kind)}导入模板.xlsx");
DownloadFileName.Template(RegistryName(kind), ".xlsx"));
}
[HttpGet("{kind}/export")]
@@ -120,7 +121,7 @@ public sealed class PersonnelExcelController(
var bytes = ExcelWorkbookHelper.Create(RegistryName(kind), headers, rows);
return File(bytes, ExcelWorkbookHelper.ContentType,
$"{RegistryName(kind)}-{DateTime.Now:yyyyMMdd-HHmm}.xlsx");
DownloadFileName.Export(RegistryName(kind), ".xlsx"));
}
[HttpGet("students/current-courses/export")]
@@ -174,7 +175,7 @@ public sealed class PersonnelExcelController(
StudentCurrentCourseHeaders,
rows);
return File(bytes, ExcelWorkbookHelper.ContentType,
$"学生正在修读课程-{DateTime.Now:yyyyMMdd-HHmm}.xlsx");
DownloadFileName.Export("学生正在修读课程", ".xlsx"));
}
[HttpPost("{kind}/import")]