修改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;
// }
//}
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[]
{