zhangbin 2 months ago
commit 49c0f3aa5e

@ -209,7 +209,7 @@ public class MinioService
.WithContentType("application/octet-stream");
//.WithContentType(file.ContentType);
await _minioClient.PutObjectAsync(putArgs);
return UseSSL ? "https://" : "http://" + endPoint + "/" + bucketName + "/" + objectName;
return "http://" + endPoint + "/" + bucketName + "/" + objectName;
}
catch (Exception ex)
{

@ -41,7 +41,9 @@ public class ConfigSubscribe : IJob
{
"thing/product/+/services_reply",
"thing/product/+/events",
"thing/product/+/requests"
"thing/product/+/requests",
"thing/product/+/osd",
"thing/product/+/status"
};
await _mqttClientManager
@ -121,8 +123,7 @@ public class ConfigSubscribe : IJob
output = new
{
bucket = _minioService._bucketName,
// todo 这里待确定
endpoint = $"http://{_minioService.endPoint}",
endpoint = $"{_minioService.endPoint}",
object_key_prefix = Guid.NewGuid().ToString(), // todo 是否设计任务id
provider = "minio",
region = "linyi",
@ -240,6 +241,11 @@ public class ConfigSubscribe : IJob
ExpectedFileCount = expectFileCount, // 期望文件数量
UploadedFileCount = uploadedFileCount // 已上传文件数量
};
// 当expectFileCount 等于uploadedFileCount时则表示航线执行完成
if (uploadedFileCount.Equals(expectFileCount))
{
taskRecord.Status = 5; // 成功状态
}
await _sqlSugarClient.Updateable(taskRecord)
.IgnoreNullColumns().ExecuteCommandAsync();
break;
@ -303,7 +309,7 @@ public class ConfigSubscribe : IJob
switch (method)
{
case "flighttask_prepare": // 下发任务响应
// todo 同一prepare消息只能处理一次
// 顺序处理,多余的不再处理
lock (_locker)
{
// 报错处理
@ -396,7 +402,9 @@ public class ConfigSubscribe : IJob
await _sqlSugarClient.Updateable(taskRecordExecute).IgnoreNullColumns().ExecuteCommandAsync();
break;
}
break;
case "thing/product/*/osd":
Console.WriteLine($"osd消息: {message}");
break;
default:
Console.WriteLine($"未进入主题处理");

@ -275,8 +275,6 @@ namespace OpenAuth.App.ServiceApp
{
using (var db = UnitWork.CreateContext())
{
if (db.LasaUav.GetFirst(r => r.Sn == info.Sn) != null)
return false;
var flag = db.LasaUav.Insert(info);
if (db.Commit())
return true;
@ -1023,6 +1021,64 @@ namespace OpenAuth.App.ServiceApp
};
}
public async Task<Response<List<LasaMediaFile>>> GetTAskImageList(string taskId)
{
var list = await Repository
.ChangeRepository<SugarRepositiry<LasaMediaFile>>()
.AsQueryable()
.Where(r => r.TaskId == taskId)
.ToListAsync();
return new Response<List<LasaMediaFile>>()
{
Result = list
};
}
public async Task<Response<bool>> StartDronePortLive(string streamUrl)
{
var request = new
{
tid = Guid.NewGuid().ToString(),
bid = Guid.NewGuid().ToString(),
timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds(),
method = "live_start_push",
data = new
{
url = streamUrl,
url_type = 1,
// 8UUXN5400A079H/165-0-7/normal-0
video_id = "8UUXN5400A079H/165-0-7/normal-0",
video_quality = 1,
}
};
//thing/product/{gateway_sn}/services
await _mqttClientManager.PublishAsync("thing/product/8UUXN5400A079H/services", JsonConvert.SerializeObject(request));
return new Response<bool>()
{
Result = true
};
}
public async Task<Response<bool>> StopDronePortLive(string streamUrl)
{
var request = new
{
tid = Guid.NewGuid().ToString(),
bid = Guid.NewGuid().ToString(),
timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds(),
method = "live_stop_push",
data = new
{
video_id = "8UUXN5400A079H/165-0-7/normal-0"
}
};
await _mqttClientManager.PublishAsync("thing/product/8UUXN5400A079H/services", JsonConvert.SerializeObject(request));
return new Response<bool>()
{
Result = true
};
}
#region 基本信息统计
public async Task<Response<JObject>> GetBasicInfo()
{

@ -65,7 +65,7 @@ namespace OpenAuth.Repository.Domain
public string AIInspection { get; set; }
/// <summary>
/// 状态 0-待执行任务 1-任务执行中 2-任务执行失败 3. 任务挂起(挂起的任务超时后,怎么处理?)
/// 状态 0-待执行任务 1-任务执行中 2-任务执行失败 3. 任务挂起(挂起的任务超时后,怎么处理?) 5. 成功
/// </summary>
public int Status { get; set; }

@ -256,6 +256,7 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
return result;
}
/// <summary>
/// 航线详情
/// </summary>
@ -480,6 +481,40 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
await _app.PendingFlyTask(taskId);
}
/// <summary>
/// 任务图片列表查询
/// </summary>
/// <param name="taskId"></param>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
public async Task<Response<List<LasaMediaFile>>> GetTAskImageList(string taskId)
{
return await _app.GetTAskImageList(taskId);
}
/// <summary>
/// 开启机场直播(测试使用)
/// </summary>
/// <param name="streamUrl"></param>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public async Task<Response<bool>> StartDronePortLive(string streamUrl)
{
return await _app.StartDronePortLive(streamUrl);
}
/// <summary>
/// 测试使用
/// </summary>
/// <param name="streamUrl"></param>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public async Task<Response<bool>> StopDronePortLive(string streamUrl)
{
return await _app.StopDronePortLive(streamUrl);
}
[HttpPost]
[AllowAnonymous]
public async Task<string> TestExecuteFlyTask(string flightid)

Loading…
Cancel
Save