diff --git a/IRaCIS.Core.Application/Service/Common/FileService.cs b/IRaCIS.Core.Application/Service/Common/FileService.cs index 4dee72352..c5955dfdc 100644 --- a/IRaCIS.Core.Application/Service/Common/FileService.cs +++ b/IRaCIS.Core.Application/Service/Common/FileService.cs @@ -3,6 +3,8 @@ using System.Text; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using IRaCIS.Core.Infrastructure; +using IRaCIS.Core.Application.Helper; +using Microsoft.AspNetCore.Hosting; namespace IRaCIS.Application.Services { @@ -11,17 +13,17 @@ namespace IRaCIS.Application.Services private readonly IDoctorService _doctorService; private readonly IAttachmentService _attachmentService; - private readonly IHostEnvironment _hostEnvironment; + private readonly IWebHostEnvironment _hostEnvironment; private string defaultUploadFilePath = string.Empty; private readonly ILogger _logger; public FileService(IDoctorService doctorService, IAttachmentService attachmentService, - IHostEnvironment hostEnvironment, ILogger logger) + IWebHostEnvironment hostEnvironment, ILogger logger) { _doctorService = doctorService; _attachmentService = attachmentService; _hostEnvironment = hostEnvironment; - defaultUploadFilePath = Directory.GetParent(_hostEnvironment.ContentRootPath.TrimEnd('\\')).IfNullThrowException().FullName; + defaultUploadFilePath = FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment); _logger = logger; } @@ -37,9 +39,10 @@ namespace IRaCIS.Application.Services //准备下载文件的临时路径 var guidStr = Guid.NewGuid().ToString(); - //string uploadFolderPath = HostingEnvironment.MapPath("/UploadFile/"); string uploadFolderPath = Path.Combine(defaultUploadFilePath, "UploadFile"); + + var tempSavePath = Path.Combine(uploadFolderPath, "temp", guidStr); //待压缩的文件夹,将需要下载的文件拷贝到此文件夹 if (!Directory.Exists(tempSavePath)) {