feature-flyModify
zhangbin 2025-09-06 08:53:28 +08:00
parent 1ebcd807c4
commit 1943129665
2 changed files with 13 additions and 13 deletions

View File

@ -189,7 +189,7 @@ namespace OpenAuth.App.ServiceApp
RefAsync<int> totalCount = 0;
using (var db = UnitWork.CreateContext())
{
var list = await db.LasaGateway.AsQueryable()
var list = await db.LasaGateway.AsQueryable()
.ToPageListAsync(page, limit, totalCount);
return new Response<PageInfo<List<LasaGateway>>>
{
@ -366,11 +366,11 @@ namespace OpenAuth.App.ServiceApp
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
public bool AddLog(LasaLog info)
public async Task<bool> AddLog(LasaLog info)
{
using (var db = UnitWork.CreateContext())
{
var flag = db.LasaLog.Insert(info);
var flag = await db.LasaLog.InsertAsync(info);
if (db.Commit())
return true;
else
@ -408,8 +408,8 @@ namespace OpenAuth.App.ServiceApp
#endregion
public async Task<Response<PageInfo<List<LasaMediaFile>>>> GetMediaFile(string taskId, string airId,string device,
int? type, string picname, DateTime? startTime, DateTime? endTime, int page, int limit, string parentKey,int? objectKeyExist)
public async Task<Response<PageInfo<List<LasaMediaFile>>>> GetMediaFile(string taskId, string airId, string device,
int? type, string picname, DateTime? startTime, DateTime? endTime, int page, int limit, string parentKey, int? objectKeyExist)
{
RefAsync<int> totalCount = 0;
using (var db = UnitWork.CreateContext())
@ -420,15 +420,15 @@ namespace OpenAuth.App.ServiceApp
.WhereIF(!string.IsNullOrEmpty(device), (x, b) => x.DroneModelKey == device)
.WhereIF(!string.IsNullOrEmpty(picname), (x, b) => x.Name.Contains(picname))
.WhereIF(!string.IsNullOrEmpty(airId), (x, b) => b.AirLineId == airId)
.WhereIF(objectKeyExist is 0,(x, b)=> x.ObjectKey == null)
.WhereIF(objectKeyExist is 1,(x, b)=> x.ObjectKey != null)
.WhereIF(objectKeyExist is 0, (x, b) => x.ObjectKey == null)
.WhereIF(objectKeyExist is 1, (x, b) => x.ObjectKey != null)
.WhereIF(!"0001/1/1 0:00:00".Equal(startTime.ToString()), (x, b) => x.CreateTime >= startTime)
.WhereIF(!"0001/1/1 0:00:00".Equal(endTime.ToString()), (x, b) => x.CreateTime <= endTime)
.WhereIF(!string.IsNullOrEmpty(parentKey), (x, b) => x.ParentKey == parentKey)
.WhereIF(!string.IsNullOrEmpty(taskId), (x, b) => x.TaskId == taskId)
.WhereIF(type != null, (x, b) => x.Type == type)
.OrderBy((x, b) => x.CreateTime, OrderByType.Desc)
.Select((x,b) => new LasaMediaFile
.Select((x, b) => new LasaMediaFile
{
Id = x.Id,
Name = x.Name,

View File

@ -23,12 +23,12 @@ namespace OpenAuth.WebApi.Model.mqtt
return topic.Contains("/osd");
}
public Task HandleAsync(string topic, string payload)
public async Task HandleAsync(string topic, string payload)
{
//_logger.LogError($"[osd] Topic={topic}, Payload={payload}");
//Console.WriteLine($"[osd] Topic={topic}, Payload={payload}");
var root = JsonNode.Parse(payload)?.AsObject();
_app.AddLog(new LasaLog
await _app.AddLog(new LasaLog
{
Id = Guid.NewGuid().ToString(),
Topic = topic,
@ -38,7 +38,7 @@ namespace OpenAuth.WebApi.Model.mqtt
});
var sub_device = root["data"]?["sub_device"]?.ToString() ?? "";
if (!string.IsNullOrEmpty(sub_device))
{
{
var data = new
{
device_sn = root["data"]?["sub_device"]?["device_sn"]?.ToString() ?? "",
@ -46,9 +46,9 @@ namespace OpenAuth.WebApi.Model.mqtt
mode_code = root["data"]?["mode_code"]?.ToString() ?? "",
};
var a = _cache.Set("DeviceState", data, DateTime.Now.AddMinutes(1));
}
}
// 自定义处理逻辑
return Task.CompletedTask;
//return Task.CompletedTask;
}
}
}