From eae20fa989620f95787764a165feead3c1e1f37a Mon Sep 17 00:00:00 2001
From: zhangbin <460190368@qq.com>
Date: Thu, 24 Jul 2025 14:26:20 +0800
Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=91=E5=AE=9A?=
=?UTF-8?q?=E7=8A=B6=E6=80=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Model/mqtt/ThingRequestHandler.cs | 2 +-
.../key-b3527dbf-bcaa-414f-a2ff-418cfa5cd713.xml | 16 ++++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
create mode 100644 OpenAuth.WebApi/temp-keys/key-b3527dbf-bcaa-414f-a2ff-418cfa5cd713.xml
diff --git a/OpenAuth.WebApi/Model/mqtt/ThingRequestHandler.cs b/OpenAuth.WebApi/Model/mqtt/ThingRequestHandler.cs
index b33b30d..086791f 100644
--- a/OpenAuth.WebApi/Model/mqtt/ThingRequestHandler.cs
+++ b/OpenAuth.WebApi/Model/mqtt/ThingRequestHandler.cs
@@ -86,7 +86,7 @@ namespace OpenAuth.WebApi.Model.mqtt
var bindStatusList = snList?.Select(sn => new
{
device_callsign = "sdhc",
- is_device_bind_organization = true,
+ is_device_bind_organization = false,
organization_id = "371300",
organization_name = "sdhc",
sn = sn
diff --git a/OpenAuth.WebApi/temp-keys/key-b3527dbf-bcaa-414f-a2ff-418cfa5cd713.xml b/OpenAuth.WebApi/temp-keys/key-b3527dbf-bcaa-414f-a2ff-418cfa5cd713.xml
new file mode 100644
index 0000000..65e3082
--- /dev/null
+++ b/OpenAuth.WebApi/temp-keys/key-b3527dbf-bcaa-414f-a2ff-418cfa5cd713.xml
@@ -0,0 +1,16 @@
+
+
+ 2025-07-24T06:13:21.826273Z
+ 2025-07-24T06:13:21.7975161Z
+ 2025-10-22T06:13:21.7975161Z
+
+
+
+
+
+
+ 020bLK2hMAxhtpFFNizORt/y5XGIzePkwQspd4UzuNPItcuu8v3ndDKcS8dxxU0v6z915v2Lw6RlW1Esro33Ew==
+
+
+
+
\ No newline at end of file
From 91c3632040f8d87bb421a8f74874513e70352a87 Mon Sep 17 00:00:00 2001
From: lgd
Date: Thu, 24 Jul 2025 14:24:32 +0800
Subject: [PATCH 2/4] =?UTF-8?q?=E7=94=9F=E4=BA=A7=E7=BC=A9=E7=95=A5?=
=?UTF-8?q?=E5=9B=BE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Infrastructure/CloudSdk/minio/MinioService.cs | 42 +++++++++++++++
.../AirportMaintenanceController.cs | 51 ++++++++++++++++++-
2 files changed, 92 insertions(+), 1 deletion(-)
diff --git a/Infrastructure/CloudSdk/minio/MinioService.cs b/Infrastructure/CloudSdk/minio/MinioService.cs
index c41e6be..1a2cf74 100644
--- a/Infrastructure/CloudSdk/minio/MinioService.cs
+++ b/Infrastructure/CloudSdk/minio/MinioService.cs
@@ -6,6 +6,7 @@ using Minio;
using Minio.DataModel;
using Minio.DataModel.Args;
using Minio.Exceptions;
+using System.IO;
namespace Infrastructure.CloudSdk.minio;
@@ -241,4 +242,45 @@ public class MinioService
var url = await _minioClient.PresignedGetObjectAsync(args);
return url;
}
+
+ public async Task PutObjectAsync(string buketName,string tupianName,string objectName,MemoryStream memory) {
+
+ if (string.IsNullOrEmpty(buketName))
+ {
+ buketName = _bucketName;
+ }
+ PutObjectArgs args = new PutObjectArgs();
+ args.WithBucket(buketName).WithObject(objectName).WithStreamData(memory).WithObjectSize(memory.Length).WithContentType("image/jpeg");
+
+ await _minioClient.PutObjectAsync(args);
+
+ }
+ public async Task GetObjectAsStream(string bucketName, string objectName)
+ {
+
+ if (string.IsNullOrEmpty(bucketName))
+ {
+ bucketName = _bucketName;
+ }
+ var memoryStream = new MemoryStream();
+ try
+ {
+ await _minioClient.GetObjectAsync(new GetObjectArgs()
+ .WithBucket(bucketName)
+ .WithObject(objectName)
+ .WithCallbackStream(stream =>
+ {
+ stream.CopyTo(memoryStream);
+ }));
+
+ memoryStream.Position = 0; // 重置流位置
+ return memoryStream;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine($"Error getting object: {e.Message}");
+ return null;
+ }
+ }
+
}
\ No newline at end of file
diff --git a/OpenAuth.WebApi/Controllers/ServiceControllers/AirportMaintenanceController.cs b/OpenAuth.WebApi/Controllers/ServiceControllers/AirportMaintenanceController.cs
index f8b9cac..f06ce4c 100644
--- a/OpenAuth.WebApi/Controllers/ServiceControllers/AirportMaintenanceController.cs
+++ b/OpenAuth.WebApi/Controllers/ServiceControllers/AirportMaintenanceController.cs
@@ -13,6 +13,12 @@ using StackExchange.Redis;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
+using SixLabors.ImageSharp;
+using SixLabors.ImageSharp.Processing;
+using SixLabors.ImageSharp.Formats.Jpeg;
+using SixLabors.ImageSharp.PixelFormats;
+using Minio;
+using Infrastructure.CloudSdk.minio;
namespace OpenAuth.WebApi.Controllers.ServiceControllers
{
@@ -27,13 +33,17 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
private readonly MqttClientManager _mqttClientManager;
private readonly MqttMessageCenter _mqttCenter;
private readonly RedisCacheContext _cache;
+ private readonly HttpClient _httpClient;
+ private readonly MinioService _minioService;
- public AirportMaintenanceController(AirportMaintenanceApp app, MqttClientManager mqttClientManager, MqttMessageCenter mqttCenter, RedisCacheContext cache)
+ public AirportMaintenanceController(AirportMaintenanceApp app, MqttClientManager mqttClientManager, MqttMessageCenter mqttCenter, RedisCacheContext cache, HttpClient httpClient,MinioService minioService)
{
_app = app;
_mqttClientManager = mqttClientManager;
_mqttCenter = mqttCenter;
_cache = cache;
+ _httpClient = httpClient;
+ _minioService = minioService;
}
///
/// 机场注册 注册码生成
@@ -745,6 +755,45 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
}
return result;
}
+ [HttpGet]
+ [AllowAnonymous]
+ public async Task> getMiniPic()
+ {
+ var result = new Response();
+ try
+ {
+ // string presignedUrl = "http://175.27.168.120:6014/test/44fc8b4b-9448-4e79-a71d-536d094b8598/ad854032-d4b7-42dc-8ac0-d1faef0ebc1e/DJI_202507231000_002_ad854032-d4b7-42dc-8ac0-d1faef0ebc1e/DJI_20250723100110_0001_V.jpeg";
+ var imageStream = _minioService.GetObjectAsStream("test", "44fc8b4b-9448-4e79-a71d-536d094b8598/ad854032-d4b7-42dc-8ac0-d1faef0ebc1e/DJI_202507231000_002_ad854032-d4b7-42dc-8ac0-d1faef0ebc1e/DJI_20250723100110_0001_V.jpeg");
+ // var imageStream = await _httpClient.GetStreamAsync(presignedUrl);
+ using (var image = Image.Load(imageStream.Result))
+ {
+ var width = image.Width;
+ var height = image.Height;
+ var thumbnailSize = 100; // 缩略图大小,可以根据需要调整
+ var thumbnail = image.Clone(ctx => ctx.Resize(new ResizeOptions
+ {
+ Size = new Size(thumbnailSize, thumbnailSize),
+ Mode = ResizeMode.Crop // 根据需要选择裁剪或填充模式
+ }));
+
+ // 将缩略图保存到内存流中(为了上传)
+ using (var memoryStream = new MemoryStream())
+ {
+ thumbnail.SaveAsJpeg(memoryStream); // 可以根据需要选择不同的格式,如Png, Bmp等。
+ memoryStream.Position = 0; // 重置流的位置到开始处
+
+ // 上传缩略图到MinIO
+ await _minioService.PutObjectAsync("test" , "suolue_DJI_20250723100110_0001_V.jpeg", "abc/suolue_DJI_20250723100110_0001_V.jpeg", memoryStream); // 根据实际格式修改Content-Type
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ result.Code = 500;
+ result.Message = ex.Message;
+ }
+ return result;
+ }
}
}
From 81d42f9f22e12a93d54d9602740adecaf83ed722 Mon Sep 17 00:00:00 2001
From: lgd
Date: Thu, 24 Jul 2025 14:54:59 +0800
Subject: [PATCH 3/4] =?UTF-8?q?=E7=94=9F=E6=88=90=E7=BC=A9=E7=95=A5?=
=?UTF-8?q?=E5=9B=BE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../ServiceApp/Subscribe/ConfigSubscribe.cs | 37 ++++++++++++++++++-
OpenAuth.Repository/Domain/LasaMediaFile.cs | 2 +
2 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/OpenAuth.App/ServiceApp/Subscribe/ConfigSubscribe.cs b/OpenAuth.App/ServiceApp/Subscribe/ConfigSubscribe.cs
index 37c2820..74a376e 100644
--- a/OpenAuth.App/ServiceApp/Subscribe/ConfigSubscribe.cs
+++ b/OpenAuth.App/ServiceApp/Subscribe/ConfigSubscribe.cs
@@ -13,8 +13,12 @@ using OpenAuth.App.ServiceApp;
using OpenAuth.Repository.Domain;
using OpenAuth.WebApi;
using Quartz;
+using SixLabors.ImageSharp;
+using SixLabors.ImageSharp.Processing;
using SqlSugar;
+
+
namespace OpenAuth.App.BaseApp.Subscribe;
public class ConfigSubscribe : IJob
@@ -261,6 +265,34 @@ public class ConfigSubscribe : IJob
.Where(a => a.ObjectKey.Equals(objectKey)).SingleAsync();
if (mediaFile == null)
{
+ string objectKey1 = data.file.object_key.ToString();
+ string suoluokey = "minipic/" + data.file.name.ToString();
+ //缩略图处理
+ var imageStream = _minioService.GetObjectAsStream("", objectKey1);
+ var width = 0;
+ var height = 0;
+ using (var image = Image.Load(imageStream.Result))
+ {
+
+ width = image.Width;
+ height = image.Height;
+ var thumbnailSize = 100; // 缩略图大小,可以根据需要调整
+ var thumbnail = image.Clone(ctx => ctx.Resize(new ResizeOptions
+ {
+ Size = new Size(thumbnailSize, thumbnailSize),
+ Mode = ResizeMode.Crop // 根据需要选择裁剪或填充模式
+ }));
+
+ // 将缩略图保存到内存流中(为了上传)
+ using (var memoryStream = new MemoryStream())
+ {
+ thumbnail.SaveAsJpeg(memoryStream); // 可以根据需要选择不同的格式,如Png, Bmp等。
+ memoryStream.Position = 0; // 重置流的位置到开始处
+
+ // 上传缩略图到MinIO
+ await _minioService.PutObjectAsync("", data.file.name.ToString(), suoluokey, memoryStream); // 根据实际格式修改Content-Type
+ }
+ }
var fileUpload = new LasaMediaFile()
{
Id = Guid.NewGuid().ToString(),
@@ -283,7 +315,10 @@ public class ConfigSubscribe : IJob
ParentKey = folderKey[2],
Tid = result.tid,
Bid = result.bid,
- FlightType = flightType
+ FlightType = flightType,
+ Width = width,
+ Height = height,
+ minipic = suoluokey
};
// todo 添加事务
await _sqlSugarClient.Insertable(fileUpload).ExecuteCommandAsync();
diff --git a/OpenAuth.Repository/Domain/LasaMediaFile.cs b/OpenAuth.Repository/Domain/LasaMediaFile.cs
index abd1bdb..a6fd314 100644
--- a/OpenAuth.Repository/Domain/LasaMediaFile.cs
+++ b/OpenAuth.Repository/Domain/LasaMediaFile.cs
@@ -116,4 +116,6 @@ public class LasaMediaFile
[SugarColumn(IsIgnore = true)]
public string PicLink { get; set; }
+
+ public string minipic { get; set; }
}
\ No newline at end of file
From 82ad3293df51126d3863196151b049c065b4327a Mon Sep 17 00:00:00 2001
From: zhangbin <460190368@qq.com>
Date: Thu, 24 Jul 2025 14:55:33 +0800
Subject: [PATCH 4/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=BB=98=E8=AE=A4?=
=?UTF-8?q?=E6=95=B0=E6=8D=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
OpenAuth.WebApi/Model/mqtt/ThingRequestHandler.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/OpenAuth.WebApi/Model/mqtt/ThingRequestHandler.cs b/OpenAuth.WebApi/Model/mqtt/ThingRequestHandler.cs
index 086791f..8accc7c 100644
--- a/OpenAuth.WebApi/Model/mqtt/ThingRequestHandler.cs
+++ b/OpenAuth.WebApi/Model/mqtt/ThingRequestHandler.cs
@@ -179,7 +179,7 @@ namespace OpenAuth.WebApi.Model.mqtt
}
}
}
- uavsn = uavsn == "" ? "1581F8HGX254V00A0BUY" : uavsn;
+ uavsn = uavsn == "" ? "01" : uavsn;
_manageApp.AddDronePort(lasaDronePort);
_manageApp.AddLasaUav(lasaUav);
var topics = new List();