下载接口
parent
b9d50179c0
commit
66b9f2dd5c
|
@ -856,7 +856,18 @@ namespace IRaCIS.Core.API.Controllers
|
|||
_userInfo = userInfo;
|
||||
}
|
||||
|
||||
/// <summary> 通用文件下载 </summary>
|
||||
[AllowAnonymous]
|
||||
[HttpGet("CommonDocument/DownloadCommonDoc")]
|
||||
public async Task<IActionResult> DownloadCommonFile(string code, [FromServices] IRepository<CommonDocument> _commonDocumentRepository)
|
||||
{
|
||||
var (filePath, fileName) = await FileStoreHelper.GetCommonDocPhysicalFilePathAsync(_hostEnvironment, _commonDocumentRepository, code);
|
||||
|
||||
new FileExtensionContentTypeProvider().Mappings.TryGetValue(Path.GetExtension(filePath), out var contentType);
|
||||
|
||||
return File(System.IO.File.OpenRead(filePath), contentType ?? "application/octet-stream", fileName);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 上传通用文档 比如一致性核查的 比如导出的excel 模板
|
||||
|
|
Loading…
Reference in New Issue