From 19708240b2ab61b9c8f34456c02e653c15d8c4ea Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 19 Jul 2024 16:12:59 +0800 Subject: [PATCH] =?UTF-8?q?oss=20=E4=B8=8B=E8=BD=BD=E8=B5=B0=E5=86=85?= =?UTF-8?q?=E7=BD=91=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.API/appsettings.Event_IRC.json | 1 + IRaCIS.Core.API/appsettings.Prod_IRC.json | 1 + IRaCIS.Core.API/appsettings.Test_IRC.json | 1 + IRaCIS.Core.API/appsettings.US_Prod_IRC.json | 1 + IRaCIS.Core.API/appsettings.US_Test_IRC.json | 1 + IRaCIS.Core.API/appsettings.US_Uat_IRC.json | 1 + IRaCIS.Core.API/appsettings.Uat_IRC.json | 1 + IRaCIS.Core.Application/Helper/OSSService.cs | 11 +++++++---- 8 files changed, 14 insertions(+), 4 deletions(-) diff --git a/IRaCIS.Core.API/appsettings.Event_IRC.json b/IRaCIS.Core.API/appsettings.Event_IRC.json index 2e9f86342..216571d78 100644 --- a/IRaCIS.Core.API/appsettings.Event_IRC.json +++ b/IRaCIS.Core.API/appsettings.Event_IRC.json @@ -14,6 +14,7 @@ "ObjectStoreUse": "AliyunOSS", "AliyunOSS": { "regionId": "cn-shanghai", + "internalEndpoint": "https://oss-cn-shanghai-internal.aliyuncs.com", "endpoint": "https://oss-cn-shanghai.aliyuncs.com", "accessKeyId": "LTAI5tKvzs7ed3UfSpNk3xwQ", "accessKeySecret": "zTIceGEShlZDGnLrCFfIGFE7TXVRio", diff --git a/IRaCIS.Core.API/appsettings.Prod_IRC.json b/IRaCIS.Core.API/appsettings.Prod_IRC.json index 02e0a3b74..7b2b1d376 100644 --- a/IRaCIS.Core.API/appsettings.Prod_IRC.json +++ b/IRaCIS.Core.API/appsettings.Prod_IRC.json @@ -16,6 +16,7 @@ "ObjectStoreUse": "AliyunOSS", "AliyunOSS": { "regionId": "cn-shanghai", + "internalEndpoint": "https://oss-cn-shanghai-internal.aliyuncs.com", "endpoint": "https://oss-cn-shanghai.aliyuncs.com", "accessKeyId": "LTAI5tKvzs7ed3UfSpNk3xwQ", "accessKeySecret": "zTIceGEShlZDGnLrCFfIGFE7TXVRio", diff --git a/IRaCIS.Core.API/appsettings.Test_IRC.json b/IRaCIS.Core.API/appsettings.Test_IRC.json index e3d28221d..b0093efe9 100644 --- a/IRaCIS.Core.API/appsettings.Test_IRC.json +++ b/IRaCIS.Core.API/appsettings.Test_IRC.json @@ -18,6 +18,7 @@ "AliyunOSS": { "regionId": "cn-shanghai", + "internalEndpoint": "https://oss-cn-shanghai-internal.aliyuncs.com", "endPoint": "https://oss-cn-shanghai.aliyuncs.com", "accessKeyId": "LTAI5tKvzs7ed3UfSpNk3xwQ", "accessKeySecret": "zTIceGEShlZDGnLrCFfIGFE7TXVRio", diff --git a/IRaCIS.Core.API/appsettings.US_Prod_IRC.json b/IRaCIS.Core.API/appsettings.US_Prod_IRC.json index 8957701a9..0c7ed8158 100644 --- a/IRaCIS.Core.API/appsettings.US_Prod_IRC.json +++ b/IRaCIS.Core.API/appsettings.US_Prod_IRC.json @@ -17,6 +17,7 @@ "ObjectStoreUse": "AWS", "AliyunOSS": { "regionId": "cn-shanghai", + "internalEndpoint": "https://oss-cn-shanghai-internal.aliyuncs.com", "endPoint": "https://oss-cn-shanghai.aliyuncs.com", "accessKeyId": "", "accessKeySecret": "", diff --git a/IRaCIS.Core.API/appsettings.US_Test_IRC.json b/IRaCIS.Core.API/appsettings.US_Test_IRC.json index 815a762e3..67d4b1fe7 100644 --- a/IRaCIS.Core.API/appsettings.US_Test_IRC.json +++ b/IRaCIS.Core.API/appsettings.US_Test_IRC.json @@ -16,6 +16,7 @@ "ObjectStoreUse": "MinIO", "AliyunOSS": { "regionId": "cn-shanghai", + "internalEndpoint": "https://oss-cn-shanghai-internal.aliyuncs.com", "endPoint": "https://oss-cn-shanghai.aliyuncs.com", "accessKeyId": "LTAI5tKvzs7ed3UfSpNk3xwQ", "accessKeySecret": "zTIceGEShlZDGnLrCFfIGFE7TXVRio", diff --git a/IRaCIS.Core.API/appsettings.US_Uat_IRC.json b/IRaCIS.Core.API/appsettings.US_Uat_IRC.json index d3f3950c8..87b6305f1 100644 --- a/IRaCIS.Core.API/appsettings.US_Uat_IRC.json +++ b/IRaCIS.Core.API/appsettings.US_Uat_IRC.json @@ -20,6 +20,7 @@ "AliyunOSS": { "regionId": "cn-shanghai", + "internalEndpoint": "https://oss-cn-shanghai-internal.aliyuncs.com", "endPoint": "https://oss-cn-shanghai.aliyuncs.com", "accessKeyId": "LTAI5tKvzs7ed3UfSpNk3xwQ", "accessKeySecret": "zTIceGEShlZDGnLrCFfIGFE7TXVRio", diff --git a/IRaCIS.Core.API/appsettings.Uat_IRC.json b/IRaCIS.Core.API/appsettings.Uat_IRC.json index d88154228..775d9d17e 100644 --- a/IRaCIS.Core.API/appsettings.Uat_IRC.json +++ b/IRaCIS.Core.API/appsettings.Uat_IRC.json @@ -16,6 +16,7 @@ "AliyunOSS": { "regionId": "cn-shanghai", + "internalEndpoint": "https://oss-cn-shanghai-internal.aliyuncs.com", "endpoint": "https://oss-cn-shanghai.aliyuncs.com", "accessKeyId": "LTAI5tKvzs7ed3UfSpNk3xwQ", "accessKeySecret": "zTIceGEShlZDGnLrCFfIGFE7TXVRio", diff --git a/IRaCIS.Core.Application/Helper/OSSService.cs b/IRaCIS.Core.Application/Helper/OSSService.cs index 93c6c62bb..9d5a754ad 100644 --- a/IRaCIS.Core.Application/Helper/OSSService.cs +++ b/IRaCIS.Core.Application/Helper/OSSService.cs @@ -39,6 +39,9 @@ namespace IRaCIS.Core.Application.Helper public string regionId { get; set; } public string accessKeyId { get; set; } public string accessKeySecret { get; set; } + + public string internalEndpoint { get; set; } + public string endPoint { get; set; } public string bucketName { get; set; } @@ -144,7 +147,7 @@ namespace IRaCIS.Core.Application.Helper { var aliConfig = ObjectStoreServiceOptions.AliyunOSS; - var _ossClient = new OssClient(aliConfig.endPoint, aliConfig.accessKeyId, aliConfig.accessKeySecret); + var _ossClient = new OssClient(aliConfig.internalEndpoint, aliConfig.accessKeyId, aliConfig.accessKeySecret); @@ -220,7 +223,7 @@ namespace IRaCIS.Core.Application.Helper { var aliConfig = ObjectStoreServiceOptions.AliyunOSS; - var _ossClient = new OssClient(aliConfig.endPoint, aliConfig.accessKeyId, aliConfig.accessKeySecret); + var _ossClient = new OssClient(aliConfig.internalEndpoint, aliConfig.accessKeyId, aliConfig.accessKeySecret); // 上传文件 var result = _ossClient.PutObject(aliConfig.bucketName, ossRelativePath, localFilePath); @@ -279,7 +282,7 @@ namespace IRaCIS.Core.Application.Helper { var aliConfig = ObjectStoreServiceOptions.AliyunOSS; - var _ossClient = new OssClient(aliConfig.endPoint, aliConfig.accessKeyId, aliConfig.accessKeySecret); + var _ossClient = new OssClient(aliConfig.internalEndpoint, aliConfig.accessKeyId, aliConfig.accessKeySecret); // 上传文件 var result = _ossClient.GetObject(aliConfig.bucketName, ossRelativePath); @@ -351,7 +354,7 @@ namespace IRaCIS.Core.Application.Helper { var aliConfig = ObjectStoreServiceOptions.AliyunOSS; - var _ossClient = new OssClient(aliConfig.endPoint, aliConfig.accessKeyId, aliConfig.accessKeySecret); + var _ossClient = new OssClient(aliConfig.internalEndpoint, aliConfig.accessKeyId, aliConfig.accessKeySecret); // 生成签名URL。 var req = new GeneratePresignedUriRequest(aliConfig.bucketName, ossRelativePath, SignHttpMethod.Get)