diff --git a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs index 7b48775da..5ef44eb2c 100644 --- a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs +++ b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs @@ -856,7 +856,18 @@ namespace IRaCIS.Core.API.Controllers _userInfo = userInfo; } + /// 通用文件下载 + [AllowAnonymous] + [HttpGet("CommonDocument/DownloadCommonDoc")] + public async Task DownloadCommonFile(string code, [FromServices] IRepository _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); + + } /// /// 上传通用文档 比如一致性核查的 比如导出的excel 模板