From cad7132b0a2d18efbc6f176b7eb2eb3c20635336 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 26 Jul 2024 09:04:34 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E8=BF=87=E7=9B=B8=E5=AF=B9=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E8=8E=B7=E5=8F=96=E6=8E=88=E6=9D=83=E7=AD=BE=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Helper/OSSService.cs | 18 +++++++++++++----- .../IRaCIS.Core.Application.xml | 6 ------ IRaCIS.Core.Application/TestService.cs | 9 ++++++--- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/IRaCIS.Core.Application/Helper/OSSService.cs b/IRaCIS.Core.Application/Helper/OSSService.cs index 9d5a754ad..175367992 100644 --- a/IRaCIS.Core.Application/Helper/OSSService.cs +++ b/IRaCIS.Core.Application/Helper/OSSService.cs @@ -375,10 +375,6 @@ namespace IRaCIS.Core.Application.Helper .WithCredentials(minIOConfig.accessKey, minIOConfig.secretKey).WithSSL(minIOConfig.useSSL) .Build(); - //var reqParams = new Dictionary(StringComparer.Ordinal) - // { - // { "response-content-type", "application/json" } - // }; var args = new PresignedGetObjectArgs() .WithBucket(minIOConfig.bucketName) @@ -404,7 +400,19 @@ namespace IRaCIS.Core.Application.Helper .WithCredentials(minIOConfig.accessKey, minIOConfig.secretKey).WithSSL(minIOConfig.useSSL) .Build(); - return string.Empty; + var args = new PresignedGetObjectArgs() + .WithBucket(minIOConfig.bucketName) + .WithObject(ossRelativePath) + .WithExpiry(3600); + + var presignedUrl = await minioClient.PresignedGetObjectAsync(args); + + Uri uri = new Uri(presignedUrl); + + string relativePath = uri.PathAndQuery; + + + return relativePath; } else { diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 160a1ae97..1525d317b 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -14096,12 +14096,6 @@ - - - 获取临床数据集合 - - - 获取单个阅片临床数据的所有文件 diff --git a/IRaCIS.Core.Application/TestService.cs b/IRaCIS.Core.Application/TestService.cs index 98cd71e87..f00d2ac7a 100644 --- a/IRaCIS.Core.Application/TestService.cs +++ b/IRaCIS.Core.Application/TestService.cs @@ -120,11 +120,14 @@ namespace IRaCIS.Application.Services public async Task TestMinIO([FromServices] IOSSService oSSService) { - await oSSService.UploadToOSSAsync("C:\\Users\\Administrator\\Desktop\\TrialSiteUserImportTemplate.xlsx", "myfolder"); + var str= await oSSService.GetSignedUrl("/01000000-c0a8-0242-1c98-08dc7ebcd37d/Read/01000000-c0a8-0242-1c98-08dc7ebcd37d/Visit/1716872544006_1716872544003.png"); - await oSSService.DownLoadFromOSSAsync("/myfolder/TrialSiteUserImportTemplate.xlsx", "C:\\Users\\Administrator\\Desktop\\aws.xlsx"); - return ResponseOutput.Ok(); + //await oSSService.UploadToOSSAsync("C:\\Users\\Administrator\\Desktop\\TrialSiteUserImportTemplate.xlsx", "myfolder"); + + //await oSSService.DownLoadFromOSSAsync("/myfolder/TrialSiteUserImportTemplate.xlsx", "C:\\Users\\Administrator\\Desktop\\aws.xlsx"); + + return ResponseOutput.Ok(str); } [AllowAnonymous]