更新设备位置

This commit is contained in:
yanghongwei 2025-04-05 17:21:17 +08:00
parent 8845f90cd3
commit c25f5463c1
1 changed files with 5 additions and 1 deletions

View File

@ -51,6 +51,10 @@ namespace LY.App.Service
return new ApiResult() { code = 1, msg = "设备不存在" }; return new ApiResult() { code = 1, msg = "设备不存在" };
} }
await _redisService.SetAsync(key, deviceinfo, TimeSpan.FromDays(1)); await _redisService.SetAsync(key, deviceinfo, TimeSpan.FromDays(1));
deviceinfo.Lat = input.product_lat;
deviceinfo.Lon = input.product_lon;
//更新位置
await _db.Updateable(deviceinfo).ExecuteCommandAsync();
} }
var entity = input.data.Adapt<List<Alarm>>(); var entity = input.data.Adapt<List<Alarm>>();
foreach (var item in entity) foreach (var item in entity)
@ -67,7 +71,7 @@ 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();
} }