diff --git a/OpenAuth.App/ServiceApp/ManageApp.cs b/OpenAuth.App/ServiceApp/ManageApp.cs index 4bf9f08..16914ec 100644 --- a/OpenAuth.App/ServiceApp/ManageApp.cs +++ b/OpenAuth.App/ServiceApp/ManageApp.cs @@ -4,8 +4,8 @@ using System.Drawing; using System.Dynamic; using System.Net; using System.Text; -using DocumentFormat.OpenXml.Office2010.Excel; using Infrastructure; +using Infrastructure.Cache; using Infrastructure.CloudSdk; using Infrastructure.CloudSdk.minio; using Infrastructure.CloudSdk.wayline; @@ -16,12 +16,9 @@ using MetadataExtractor.Formats.Exif; using MetadataExtractor.Formats.Xmp; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; -using Microsoft.IdentityModel.Tokens; -using Microsoft.Net.Http.Headers; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using OpenAuth.App.BaseApp.Base; -using OpenAuth.App.BaseApp.Subscribe; using OpenAuth.App.BasicQueryService; using OpenAuth.App.Interface; using OpenAuth.App.Request; @@ -50,9 +47,11 @@ namespace OpenAuth.App.ServiceApp private readonly ConcurrentDictionary _processedMessages = new(); private readonly TimeSpan _deduplicationWindow = TimeSpan.FromMinutes(1); + private readonly RedisCacheContext _redisCacheContext; + public ManageApp(ISugarUnitOfWork unitWork, ISimpleClient repository, IAuth auth, MqttClientManager mqttClientManager, CommonDataManager commonDataManager, MinioService minioService, - OpenJobApp openJobApp, ILogger logger) + OpenJobApp openJobApp, ILogger logger, RedisCacheContext redisCacheContext) : base(unitWork, repository, auth) { _mqttClientManager = mqttClientManager; @@ -60,6 +59,7 @@ namespace OpenAuth.App.ServiceApp _commonDataManager = commonDataManager; _openJobApp = openJobApp; _logger = logger; + _redisCacheContext = redisCacheContext; } #region 机场管理 @@ -2936,5 +2936,28 @@ WHERE Result = x }; } + + public async Task> GetDronePortInfo(string dronePortSn) + { + var info = _redisCacheContext.Get(dronePortSn); + var infoObj = JObject.Parse(info); + var modeCode = infoObj["mode_code"]?.ToString(); + var droneInDock = infoObj["drone_in_dock"]?.ToString(); + if (modeCode != null && droneInDock != null) + { + return new Response + { + Result = new + { + modeCode, droneInDock + } + }; + } + return new Response + { + Message = "查询失败", + Code = 500 + }; + } } } \ No newline at end of file diff --git a/OpenAuth.WebApi/Controllers/ServiceControllers/ManageController.cs b/OpenAuth.WebApi/Controllers/ServiceControllers/ManageController.cs index d65ad26..0980f80 100644 --- a/OpenAuth.WebApi/Controllers/ServiceControllers/ManageController.cs +++ b/OpenAuth.WebApi/Controllers/ServiceControllers/ManageController.cs @@ -986,5 +986,12 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers { return await _app.ListDronePort(lng, lat); } + // todo + [HttpGet] + [AllowAnonymous] + public async Task> GetDronePortInfo(string dronePortSn) + { + return await _app.GetDronePortInfo(dronePortSn); + } } } \ No newline at end of file