diff --git a/OpenAuth.WebApi/Controllers/ServiceControllers/AirportMaintenanceController.cs b/OpenAuth.WebApi/Controllers/ServiceControllers/AirportMaintenanceController.cs index 5fa36fa..1cc2cc0 100644 --- a/OpenAuth.WebApi/Controllers/ServiceControllers/AirportMaintenanceController.cs +++ b/OpenAuth.WebApi/Controllers/ServiceControllers/AirportMaintenanceController.cs @@ -749,14 +749,19 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers // return result; // } //} - var existingLocked = ParseClient(await _cache.HashGetAllAsync($"client:{info.DeviceSn}")); - if (existingLocked.DeviceSn == info.DeviceSn && existingLocked.UserId != info.UserId && existingLocked.IsLock) + var hashEntries = await _cache.HashGetAllAsync($"client:{info.DeviceSn}"); + if (hashEntries.Length > 0) { - result.Code = 400; - result.Message = "已有用户处于锁定状态,不能添加新的锁定用户。"; - result.Result = false; - return result; + var existingLocked = ParseClient(hashEntries); + if (existingLocked.DeviceSn == info.DeviceSn && existingLocked.UserId != info.UserId && existingLocked.IsLock) + { + result.Code = 400; + result.Message = "已有用户处于锁定状态,不能添加新的锁定用户。"; + result.Result = false; + return result; + } } + // 存客户端信息 _cache.HashSetAsync(clientKey, new HashEntry[] {