diff --git a/OpenAuth.App/ServiceApp/Subscribe/ConfigSubscribe.cs b/OpenAuth.App/ServiceApp/Subscribe/ConfigSubscribe.cs index 028bb1c..2acf480 100644 --- a/OpenAuth.App/ServiceApp/Subscribe/ConfigSubscribe.cs +++ b/OpenAuth.App/ServiceApp/Subscribe/ConfigSubscribe.cs @@ -82,7 +82,7 @@ public class ConfigSubscribe : IJob } - private async Task HandleTopic(MqttApplicationMessageReceivedEventArgs args, string topic, + public async Task HandleTopic(MqttApplicationMessageReceivedEventArgs args, string topic, string message) { // 序列号提取 @@ -675,9 +675,8 @@ public class ConfigSubscribe : IJob _logger.LogInformation("跳过处理"); break; } - var task = await _sqlSugarClient.Queryable() - .FirstAsync(y => y.Id == taskAssign1.TaskId); + .SingleAsync(y => y.Id == taskAssign1.TaskId); if (task != null && !string.IsNullOrEmpty(task.AIInspection) && task.AIInspection.Equals("true") && string.IsNullOrEmpty(task.PushUrl)) { @@ -693,7 +692,8 @@ public class ConfigSubscribe : IJob var cameraIndex = "99-0-0"; if (lasaDronePort.TypeId == "M3TD") { - cameraIndex = "99-0-1"; + // 81-0-0 + cameraIndex = "81-0-0"; } //var rtmp = "rtmp://box.wisestcity.com:1935/live/7"; @@ -707,15 +707,17 @@ public class ConfigSubscribe : IJob ""data"": {{ ""url_type"": 1, ""url"": ""{rtmp}{lasaDronePort.UavSn}"", - ""video_id"": ""{lasaDronePort.uavSn}/{cameraIndex}/normal-0"", + ""video_id"": ""{lasaDronePort.UavSn}/{cameraIndex}/normal-0"", ""video_quality"": 3 }} }}"; + // todo 到这里未执行?? 确定是否是123上执行的 但如何后面没执行,怎么开启的直播呢? + // todo 关于开启直播的,再在这里调用开启直播,是否还会继续执行下去? _logger.LogDebug($"直播参数:{param}"); + _liveInfo[$"{tid}{bid}"] = taskAssign1.TaskId + "," + lasaDronePort.UavSn; var topicRequest = $"thing/product/{sn}/services"; // 开启直播 await _mqttClientManager.PublishAsync(topicRequest, param); - _liveInfo[$"{tid}{bid}"] = taskAssign1.TaskId + "," + lasaDronePort.UavSn; } } } @@ -770,7 +772,6 @@ public class ConfigSubscribe : IJob var tempTaskId = _liveInfo[$"{result.tid}{result.bid}"].Split(","); _logger.LogDebug($"智能巡检TaskId:{tempTaskId[0]}"); _liveInfo.TryRemove($"{result.tid}{result.bid}", out _); - // todo var req = new CallAiModel { TaskId = tempTaskId[0], RtmpUrl = rtmp + tempTaskId[1] }; _logger.LogDebug($"智能巡检调用参数:{JsonConvert.SerializeObject(req)}"); _ = _manageApp.CallAiModel(req); diff --git a/OpenAuth.Repository/Domain/LasaTask.cs b/OpenAuth.Repository/Domain/LasaTask.cs index a2ed6ff..f3e4864 100644 --- a/OpenAuth.Repository/Domain/LasaTask.cs +++ b/OpenAuth.Repository/Domain/LasaTask.cs @@ -1,9 +1,4 @@ using SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace OpenAuth.Repository.Domain { @@ -153,9 +148,9 @@ namespace OpenAuth.Repository.Domain /// 断点信息 /// public string BreakPoint { get; set; } - + public string PushUrl { get; set; } - + public int? FlyNumber { get; set; } [SugarColumn(IsIgnore = true)] public string AlgoInstanceId { get; set; } diff --git a/OpenAuth.WebApi/Controllers/ServiceControllers/ManageController.cs b/OpenAuth.WebApi/Controllers/ServiceControllers/ManageController.cs index 0980f80..830d04b 100644 --- a/OpenAuth.WebApi/Controllers/ServiceControllers/ManageController.cs +++ b/OpenAuth.WebApi/Controllers/ServiceControllers/ManageController.cs @@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using Newtonsoft.Json.Linq; +using OpenAuth.App.BaseApp.Subscribe; using OpenAuth.App.ServiceApp; using OpenAuth.App.ServiceApp.AirLine.Request; using OpenAuth.App.ServiceApp.FlyTask.Request; @@ -26,10 +27,13 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers private readonly ManageApp _app; private readonly MqttClientManager _mqttClientManager; - public ManageController(ManageApp app, MqttClientManager mqttClientManager) + private readonly ConfigSubscribe _configSubscribe; + + public ManageController(ManageApp app, MqttClientManager mqttClientManager, ConfigSubscribe configSubscribe) { _app = app; _mqttClientManager = mqttClientManager; + _configSubscribe = configSubscribe; } #region 机场管理 @@ -986,6 +990,7 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers { return await _app.ListDronePort(lng, lat); } + // todo [HttpGet] [AllowAnonymous] @@ -993,5 +998,18 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers { return await _app.GetDronePortInfo(dronePortSn); } + + + /// + /// 用于测试各种mqtt消息 + /// + /// + /// + [HttpPost] + //[AllowAnonymous] + public async void TestConfSubscribe(String topic, String message) + { + await _configSubscribe.HandleTopic(null, topic, message); + } } } \ No newline at end of file