fix 心跳间隔控制
This commit is contained in:
@@ -43,7 +43,6 @@ public class DeviceSaveRequest : IValidatableObject
|
||||
/// <summary>
|
||||
/// 心跳间隔
|
||||
/// </summary>
|
||||
[Range(0, int.MaxValue)]
|
||||
public int HeartbeatInterval { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -83,5 +82,10 @@ public class DeviceSaveRequest : IValidatableObject
|
||||
{
|
||||
yield return new ValidationResult($"{DeviceTypeEnumType.Door.GetDescription()}才可设置作为考勤设备", new[] { nameof(AsAttendance) });
|
||||
}
|
||||
|
||||
if (HeartbeatInterval != 0 && HeartbeatInterval < 30)
|
||||
{
|
||||
yield return new ValidationResult($"心跳间隔需要设置>=30秒", new[] { nameof(HeartbeatInterval) });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public class HeartbeatJob
|
||||
_dbContext.Client.QueryFilter.ClearAndBackup<ITenantId>();
|
||||
try
|
||||
{
|
||||
var devices = await _dbContext.Queryable<DeviceEntity>().Where(x => x.Enable).ToListAsync();
|
||||
var devices = await _dbContext.Queryable<DeviceEntity>().Where(x => x.Enable).Where(x => x.HeartbeatInterval > 0).ToListAsync();
|
||||
foreach (var device in devices)
|
||||
{
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user