From 57dd964db28842a8a9bdf236ac2dda04a0a046fb Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Mon, 17 Feb 2025 14:07:28 +0800 Subject: [PATCH] =?UTF-8?q?minio=20=E5=8C=BA=E5=9F=9F=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=EF=BC=8C=E5=AF=BC=E8=87=B4=E4=B8=8A=E4=BC=A0=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRC.Core.SCP/IRC.Core.SCP.csproj | 2 +- IRC.Core.SCP/Properties/launchSettings.json | 4 ++-- IRC.Core.SCP/Service/OSSService.cs | 13 ++++++++++++- IRC.Core.SCP/appsettings.Uat_HIR_SCP.json | 4 ++-- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/IRC.Core.SCP/IRC.Core.SCP.csproj b/IRC.Core.SCP/IRC.Core.SCP.csproj index 768c65fef..0e0f46130 100644 --- a/IRC.Core.SCP/IRC.Core.SCP.csproj +++ b/IRC.Core.SCP/IRC.Core.SCP.csproj @@ -19,7 +19,7 @@ - + true diff --git a/IRC.Core.SCP/Properties/launchSettings.json b/IRC.Core.SCP/Properties/launchSettings.json index dff3134b7..51e43cc85 100644 --- a/IRC.Core.SCP/Properties/launchSettings.json +++ b/IRC.Core.SCP/Properties/launchSettings.json @@ -11,14 +11,14 @@ "ASPNETCORE_ENVIRONMENT": "Test_HIR_SCP" } }, - "Uat_IRC_SCP": { + "Uat_HIR_SCP": { "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, "launchUrl": "swagger", "applicationUrl": "http://localhost:6200", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Test_HIR_SCP" + "ASPNETCORE_ENVIRONMENT": "Uat_HIR_SCP" } } } diff --git a/IRC.Core.SCP/Service/OSSService.cs b/IRC.Core.SCP/Service/OSSService.cs index 1ac5e80ee..845bfa116 100644 --- a/IRC.Core.SCP/Service/OSSService.cs +++ b/IRC.Core.SCP/Service/OSSService.cs @@ -12,6 +12,7 @@ using MassTransit; using Microsoft.Extensions.Options; using Minio; using Minio.DataModel.Args; +using System.Net; using System.Reactive.Linq; using System.Runtime.InteropServices; @@ -216,9 +217,19 @@ public class OSSService : IOSSService .WithBucket(minIOConfig.BucketName) .WithObject(ossRelativePath) .WithStreamData(memoryStream) + .WithObjectSize(memoryStream.Length); - await minioClient.PutObjectAsync(putObjectArgs); + var putResponse = await minioClient.PutObjectAsync(putObjectArgs); + + if (putResponse.ResponseStatusCode == HttpStatusCode.OK) + { + + } + else + { + throw new BusinessValidationFailedException($"上传发生异常:{putResponse.ResponseContent}"); + } } else if (ObjectStoreServiceOptions.ObjectStoreUse == "AWS") { diff --git a/IRC.Core.SCP/appsettings.Uat_HIR_SCP.json b/IRC.Core.SCP/appsettings.Uat_HIR_SCP.json index eaf54ff41..3b821ea75 100644 --- a/IRC.Core.SCP/appsettings.Uat_HIR_SCP.json +++ b/IRC.Core.SCP/appsettings.Uat_HIR_SCP.json @@ -12,8 +12,8 @@ "EndPoint": "101.132.253.119", "Port": "9001", "UseSSL": false, - "AccessKeyId": "L6owzRVeDJJw3PcRmK2c", - "SecretAccessKey": "2XvFDYSH7EyHQNtpDCgk4efgdsdarQmRKgx1LlOI", + "AccessKeyId": "ylWQa99fDdVdTfnj47ll", + "SecretAccessKey": "kVpy2RIYN0GmyFsU2qAWhbKDf4Nskt23tEqd6sob", "BucketName": "hir-uat", "ViewEndpoint": "http://101.132.253.119:9001/hir-uat/" }