From c30bd42830e6a4057c374247c1e718ab479c6512 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E4=BC=9F?= <421281095@qq.com> Date: Wed, 2 Jul 2025 09:26:48 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E4=B8=B4=E6=97=B6=E5=87=AD=E8=AF=81?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0minio=E9=85=8D=E7=BD=AE=E5=8C=96=202.=20bugfi?= =?UTF-8?q?x:=20=E5=AA=92=E4=BD=93=E6=95=B0=E9=87=8F=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BaseApp/Subscribe/ConfigSubscribe.cs | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/OpenAuth.App/BaseApp/Subscribe/ConfigSubscribe.cs b/OpenAuth.App/BaseApp/Subscribe/ConfigSubscribe.cs index c720bc8..1269560 100644 --- a/OpenAuth.App/BaseApp/Subscribe/ConfigSubscribe.cs +++ b/OpenAuth.App/BaseApp/Subscribe/ConfigSubscribe.cs @@ -1,6 +1,7 @@ using System.Dynamic; using System.Text; using Infrastructure.Cache; +using Infrastructure.CloudSdk.minio; using Infrastructure.CloudSdk.wayline; using MQTTnet; using MQTTnet.Client; @@ -19,15 +20,17 @@ public class ConfigSubscribe : IJob private readonly ISqlSugarClient _sqlSugarClient; private readonly RedisCacheContext _redisCacheContext; private readonly ManageApp _manageApp; + private readonly MinioService _minioService; private object _locker = new(); public ConfigSubscribe(MqttClientManager mqttClientManager, ISqlSugarClient sqlSugarClient, - ICacheContext redisCacheContext, ManageApp manageApp) + ICacheContext redisCacheContext, ManageApp manageApp, MinioService minioService) { _mqttClientManager = mqttClientManager; _sqlSugarClient = sqlSugarClient; _redisCacheContext = redisCacheContext as RedisCacheContext; _manageApp = manageApp; + _minioService = minioService; } private async Task Subscribe() @@ -104,27 +107,29 @@ public class ConfigSubscribe : IJob // "need_reply":0,"tid":"50e8102c-da72-42b1-a899-a82a519456d9", // "timestamp":1750575776430, // "gateway":"8UUXN5400A079H"} - //todo 配置中读取minio配置 + // 配置中读取minio配置 var storageConfigRequest = new TopicServicesRequest() { method = "storage_config_get", tid = result.tid, bid = result.bid, timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds(), + data = new { result = 0, output = new { - bucket = "test", - endpoint = "http://175.27.168.120:6013", + bucket = _minioService._bucketName, + // todo 这里待确定 + endpoint = $"http://{_minioService.endPoint}", object_key_prefix = Guid.NewGuid().ToString(), // todo 是否设计任务id ? provider = "minio", region = "linyi", credentials = new { - access_key_id = "minioadmin", - access_key_secret = "minioadmin", + access_key_id = _minioService.AccessKey, + access_key_secret = _minioService.SecretKey, expire = 7200, security_token = "" } @@ -226,15 +231,14 @@ public class ConfigSubscribe : IJob await _sqlSugarClient.Insertable(fileUpload).ExecuteCommandAsync(); var expectFileCount = data.flight_task.expected_file_count; var uploadedFileCount = data.flight_task.uploaded_file_count; - string taskId = _manageApp.GetTaskAssignByFlightId(data.flight_task.id).TaskId; + string taskId = _manageApp.GetTaskAssignByFlightId(flightId).TaskId; var taskRecord = new LasaTask() { Id = taskId, - ExpectedFileCount = expectFileCount, - UploadedFileCount = uploadedFileCount + ExpectedFileCount = expectFileCount, // 期望文件数量 + UploadedFileCount = uploadedFileCount // 已上传文件数量 }; await _sqlSugarClient.Updateable(taskRecord) - .Where(t => t.FlightId == fileUpload.FlightId) .IgnoreNullColumns().ExecuteCommandAsync(); break; case "release_terminal_control_area":