设备列表加入是否在线

This commit is contained in:
yanghongwei 2025-08-27 22:06:49 +08:00
parent 5122193a28
commit a474ded6a1
2 changed files with 8 additions and 1 deletions

View File

@ -1,4 +1,5 @@
using LY.App.Device;
using GraphQL;
using LY.App.Device;
using Newtonsoft.Json;
using SqlSugar;
@ -75,6 +76,8 @@ namespace LY.App.Model
[SugarColumn(ColumnName = "is_move", ColumnDescription = "是否移动设备", IsNullable = true)]
public bool isMove { get; set; }
[SugarColumn(IsIgnore = true)]
public bool online { get; set; }
}

View File

@ -47,6 +47,10 @@ namespace LY.App.Service
.WhereIF(!string.IsNullOrEmpty(key), s => s.Name.Contains(key) || s.DeviceSN.Contains(key))
.OrderByDescending(s => s.Id)
.ToPageListAsync(pageNum, pageSize, total);
items.ForEach(async s =>
{
s.online = await _redisService.ExistsAsync(RedisKeyList.DeviceStatus(s.DeviceSN));
});
return new ApiResult()
{
data = new