zhangbin 2025-10-31 09:15:26 +08:00
commit 56aae9e91d
2 changed files with 35 additions and 5 deletions

View File

@ -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<string, DateTime> _processedMessages = new();
private readonly TimeSpan _deduplicationWindow = TimeSpan.FromMinutes(1);
private readonly RedisCacheContext _redisCacheContext;
public ManageApp(ISugarUnitOfWork<SugarDbContext> unitWork, ISimpleClient<LasaDronePort> repository, IAuth auth,
MqttClientManager mqttClientManager, CommonDataManager commonDataManager, MinioService minioService,
OpenJobApp openJobApp, ILogger<LasaDronePort> logger)
OpenJobApp openJobApp, ILogger<LasaDronePort> 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<Response<dynamic>> GetDronePortInfo(string dronePortSn)
{
var info = _redisCacheContext.Get<string>(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<dynamic>
{
Result = new
{
modeCode, droneInDock
}
};
}
return new Response<dynamic>
{
Message = "查询失败",
Code = 500
};
}
}
}

View File

@ -986,5 +986,12 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
{
return await _app.ListDronePort(lng, lat);
}
// todo
[HttpGet]
[AllowAnonymous]
public async Task<Response<dynamic>> GetDronePortInfo(string dronePortSn)
{
return await _app.GetDronePortInfo(dronePortSn);
}
}
}