修改redis判断条件

main
zhangbin 2025-12-23 14:06:15 +08:00
parent 600418d0ab
commit eb8f003d0c
1 changed files with 11 additions and 6 deletions

View File

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