文件下载名称调优
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.Common;
|
||||
using Jiaowu.Api.Domain.Identity;
|
||||
using Jiaowu.Api.Infrastructure.Caching;
|
||||
using Jiaowu.Api.Infrastructure.Excel;
|
||||
using Jiaowu.Api.Infrastructure.Files;
|
||||
using Jiaowu.Api.Infrastructure.Persistence;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -46,7 +47,7 @@ public sealed class BaseDataExcelController(AppDbContext db, IAppCache cache) :
|
||||
"状态填写“启用”或“停用”;是/否字段填写“是”或“否”。",
|
||||
"整批数据会先校验,任一行有误时均不会写入。"
|
||||
]);
|
||||
return File(bytes, ExcelWorkbookHelper.ContentType, $"{KindName(kind)}导入模板.xlsx");
|
||||
return File(bytes, ExcelWorkbookHelper.ContentType, DownloadFileName.Template(KindName(kind), ".xlsx"));
|
||||
}
|
||||
|
||||
[HttpGet("{kind}/export")]
|
||||
@@ -56,7 +57,7 @@ public sealed class BaseDataExcelController(AppDbContext db, IAppCache cache) :
|
||||
var rows = await GetExportRowsAsync(kind, cancellationToken);
|
||||
var bytes = ExcelWorkbookHelper.Create(KindName(kind), headers, rows);
|
||||
return File(bytes, ExcelWorkbookHelper.ContentType,
|
||||
$"{KindName(kind)}-{DateTime.Now:yyyyMMdd-HHmm}.xlsx");
|
||||
DownloadFileName.Export(KindName(kind), ".xlsx"));
|
||||
}
|
||||
|
||||
[HttpPost("{kind}/import")]
|
||||
|
||||
Reference in new issue
Block a user