add ip字段返回
This commit is contained in:
@@ -41,6 +41,7 @@ public class DevicesController : ControllerBase
|
||||
HeartbeatInterval = x.HeartbeatInterval,
|
||||
DirectionType = x.DeployDirection,
|
||||
LastHeartbeatTime = xr.LastHeartbeatTime,
|
||||
ConnectionInfo = x.ConnectionInfo
|
||||
})
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Dlhis.External.OpenApi.Response;
|
||||
|
||||
@@ -49,4 +52,27 @@ public class DeviceResponse
|
||||
return LastHeartbeatTime.Value.AddSeconds(HeartbeatInterval) >= DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
public string ConnectionInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备列表
|
||||
/// </summary>
|
||||
public string Ip
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!ConnectionInfo.IsPresent())
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
var jObj = JObject.Parse(ConnectionInfo);
|
||||
|
||||
return jObj.TryGetValue("ip", out var ip)
|
||||
? ip.Value<string>()
|
||||
: string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user