From b991e9950f00c93ec271dc3f9c875910e9650146 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 16 May 2023 17:09:15 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=A9=E7=95=A5?= =?UTF-8?q?=E5=9B=BE=E5=88=87=E6=8D=A2=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/ImageAndDoc/SeriesService.cs | 40 +++++++++++-------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/SeriesService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/SeriesService.cs index 4fe42154f..8dab5e9b9 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/SeriesService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/SeriesService.cs @@ -147,30 +147,36 @@ namespace IRaCIS.Core.Application.Services #region 切换磁盘存储后 - var physicalPath = string.Empty; + var physicalPath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, path); - //找到所有磁盘 - var drives = DriveInfo.GetDrives() - .Where(d => d.DriveType == DriveType.Fixed && d.IsReady) - //剩余空间最多的 - .OrderByDescending(d => d.AvailableFreeSpace) - - //存储空间相同,则按照按照总空间从大到小排序 - .ThenByDescending(d => d.TotalSize - d.TotalFreeSpace) - .Select(d => d.RootDirectory.FullName) - .ToList(); - - - foreach (var drive in drives) + //不存在,去其他路径找 + if (!File.Exists(physicalPath)) { - physicalPath = Path.Combine(drive, _hostEnvironment.EnvironmentName, path.Trim('/')); + //找到所有磁盘 + var drives = DriveInfo.GetDrives() + .Where(d => d.DriveType == DriveType.Fixed && d.IsReady) + //剩余空间最多的 + .OrderByDescending(d => d.AvailableFreeSpace) - if(File.Exists(physicalPath)) + //存储空间相同,则按照按照总空间从大到小排序 + .ThenByDescending(d => d.TotalSize - d.TotalFreeSpace) + .Select(d => d.RootDirectory.FullName) + .ToList(); + + + foreach (var drive in drives) { - break; + physicalPath = Path.Combine(drive, _hostEnvironment.EnvironmentName, path.Trim('/')); + + if (File.Exists(physicalPath)) + { + break; + } } } + + #endregion From 8cffbd99010490d41d85ca1bf9b5714e18319859 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 16 May 2023 17:26:47 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=8A=A8=E6=80=81=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E5=AD=98=E5=82=A8=E4=BF=AE=E6=94=B9=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IRacisHostFile/MultiDiskStaticFilesMiddleware.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/IRaCIS.Core.API/_PipelineExtensions/IRacisHostFile/MultiDiskStaticFilesMiddleware.cs b/IRaCIS.Core.API/_PipelineExtensions/IRacisHostFile/MultiDiskStaticFilesMiddleware.cs index 9ffff786c..e5c4ee39d 100644 --- a/IRaCIS.Core.API/_PipelineExtensions/IRacisHostFile/MultiDiskStaticFilesMiddleware.cs +++ b/IRaCIS.Core.API/_PipelineExtensions/IRacisHostFile/MultiDiskStaticFilesMiddleware.cs @@ -49,7 +49,7 @@ namespace IRaCIS.Core.API var isDicomFile = path.Contains($"{StaticData.Folder.DicomFolder}"); - var defaultFileProvider = new PhysicalFileProvider(iRaCISDefaultDataFolder); + var defaultFileProvider = new PhysicalFileProvider(FileStoreHelper.GetIRaCISRootPath(_hostingEnv)); var staticFileOptions = new StaticFileOptions { FileProvider = defaultFileProvider, @@ -65,12 +65,11 @@ namespace IRaCIS.Core.API { if (defaultFileProvider.GetFileInfo(context.Request.Path).Exists) { - //var staticFileMiddleware = new StaticFileMiddleware(_next, _hostingEnv, Options.Create(staticFileOptions), _loggerFactory); - //await staticFileMiddleware.Invoke(context); var actrualPath = defaultFileProvider.GetFileInfo(context.Request.Path).PhysicalPath; await context.Response.SendFileAsync(new PhysicalFileInfo(new FileInfo(actrualPath))); + return; } }