48 lines
1.0 KiB
C#
48 lines
1.0 KiB
C#
using Dlhis.Entity.Device.Enums;
|
|
|
|
namespace Dlhis.External.OpenApi.Response;
|
|
|
|
public class DeviceResponse
|
|
{
|
|
public string DeviceNo { get; set; }
|
|
|
|
/// <summary>
|
|
/// 心跳间隔
|
|
/// </summary>
|
|
public int HeartbeatInterval { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
/// 设备类型, 1:门禁, 3:考勤
|
|
/// </summary>
|
|
public DeviceTypeEnumType Type { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
/// 部署方向,10:进;20:出
|
|
/// </summary>
|
|
public DeviceDeployDirectionEnumType? DirectionType { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
/// 最后心跳时间
|
|
/// </summary>
|
|
public DateTime? LastHeartbeatTime { get; set; }
|
|
|
|
/// <summary>
|
|
/// 是否在线
|
|
/// </summary>
|
|
public bool IsOnline
|
|
{
|
|
get
|
|
{
|
|
if (!LastHeartbeatTime.HasValue)
|
|
return false;
|
|
|
|
if (HeartbeatInterval <= 0)
|
|
return true;
|
|
|
|
return LastHeartbeatTime.Value.AddSeconds(HeartbeatInterval) >= DateTime.Now;
|
|
}
|
|
}
|
|
} |