This commit is contained in:
yanghongwei 2025-04-06 21:56:20 +08:00
parent fa3773c8dc
commit e72164545e
1 changed files with 17 additions and 13 deletions

View File

@ -51,6 +51,8 @@ namespace LY.App.Service
await _redisService.SetAsync(key, deviceinfo, TimeSpan.FromDays(1)); await _redisService.SetAsync(key, deviceinfo, TimeSpan.FromDays(1));
} }
var entity = input.data.Adapt<List<Alarm>>(); var entity = input.data.Adapt<List<Alarm>>();
if (entity.Any())
{
foreach (var item in entity) foreach (var item in entity)
{ {
item.BatchId = await GetBatId(item.serial_number); item.BatchId = await GetBatId(item.serial_number);
@ -65,6 +67,8 @@ namespace LY.App.Service
await _db.CopyNew().Insertable(entity).SplitTable().ExecuteReturnSnowflakeIdListAsync(); await _db.CopyNew().Insertable(entity).SplitTable().ExecuteReturnSnowflakeIdListAsync();
//推送报警信息 //推送报警信息
await _pushService.SendMessageToAll(new { msgType = "event", data = entity }); await _pushService.SendMessageToAll(new { msgType = "event", data = entity });
}
return new ApiResult(); return new ApiResult();
} }
@ -128,7 +132,7 @@ namespace LY.App.Service
await _redisService.SetAsync(key, deviceinfo); await _redisService.SetAsync(key, deviceinfo);
//更新位置 //更新位置
// await _db.Updateable(deviceinfo).ExecuteCommandAsync(); // await _db.Updateable(deviceinfo).ExecuteCommandAsync();
await _db.Updateable<DeviceEntity>(deviceinfo).ExecuteCommandAsync(); await _db.CopyNew().Updateable<DeviceEntity>(deviceinfo).ExecuteCommandAsync();
} }
} }
private async Task<long> GetBatId(string droneId) private async Task<long> GetBatId(string droneId)