From eb8f003d0c589dae73f74a63908ea9c76cb309c6 Mon Sep 17 00:00:00 2001 From: zhangbin <460190368@qq.com> Date: Tue, 23 Dec 2025 14:06:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9redis=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AirportMaintenanceController.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) 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[] {