细节调整
This commit is contained in:
parent
c25f5463c1
commit
7bf4c684b2
|
|
@ -39,23 +39,20 @@ namespace LY.App.Service
|
|||
public async Task<ApiResult> AddAlarm(RevData input)
|
||||
{
|
||||
await SetDeviceStataus(input);
|
||||
if (input.data.Any())
|
||||
var key = RedisKeyList.DeviceInfo(input.product_ad_id);
|
||||
var deviceinfo = await _redisService.GetAsync<DeviceEntity>(key);
|
||||
if (deviceinfo == null)
|
||||
{
|
||||
var key = RedisKeyList.DeviceInfo(input.product_ad_id);
|
||||
var deviceinfo = await _redisService.GetAsync<DeviceEntity>(key);
|
||||
deviceinfo = await _db.CopyNew().Queryable<DeviceEntity>().Where(s => s.DeviceSN == input.product_ad_id).FirstAsync();
|
||||
if (deviceinfo == null)
|
||||
{
|
||||
deviceinfo = await _db.CopyNew().Queryable<DeviceEntity>().Where(s => s.DeviceSN == input.product_ad_id).FirstAsync();
|
||||
if (deviceinfo == null)
|
||||
{
|
||||
return new ApiResult() { code = 1, msg = "设备不存在" };
|
||||
}
|
||||
await _redisService.SetAsync(key, deviceinfo, TimeSpan.FromDays(1));
|
||||
deviceinfo.Lat = input.product_lat;
|
||||
deviceinfo.Lon = input.product_lon;
|
||||
//更新位置
|
||||
await _db.Updateable(deviceinfo).ExecuteCommandAsync();
|
||||
return new ApiResult() { code = 1, msg = "设备不存在" };
|
||||
}
|
||||
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>>();
|
||||
foreach (var item in entity)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue