优化用户导入

This commit is contained in:
不做码农
2023-05-07 08:51:10 +08:00
parent 5a3e513a6b
commit 7cfa543865
5 changed files with 35 additions and 24 deletions

View File

@@ -170,7 +170,7 @@ namespace ZR.Admin.WebApi.Controllers
{
IWebHostEnvironment webHostEnvironment = (IWebHostEnvironment)App.ServiceProvider.GetService(typeof(IWebHostEnvironment));
string sFileName = $"{fileName}模板.xlsx";
string newFileName = Path.Combine(webHostEnvironment.WebRootPath, "importTemplate", sFileName);
string newFileName = Path.Combine(webHostEnvironment.WebRootPath, "ImportTemplate", sFileName);
if (!Directory.Exists(newFileName))
{
@@ -179,5 +179,19 @@ namespace ZR.Admin.WebApi.Controllers
MiniExcel.SaveAs(newFileName, list);
return sFileName;
}
/// <summary>
/// 下载指定文件模板
/// </summary>
/// <param name="fileName">下载文件名</param>
/// <returns></returns>
protected (string, string) DownloadImportTemplate(string fileName)
{
IWebHostEnvironment webHostEnvironment = (IWebHostEnvironment)App.ServiceProvider.GetService(typeof(IWebHostEnvironment));
string sFileName = $"{fileName}.xlsx";
string fullPath = Path.Combine(webHostEnvironment.WebRootPath, "ImportTemplate", sFileName);
return (sFileName, fullPath);
}
}
}