修改redis

main
zhangbin 2025-11-29 16:38:53 +08:00
parent d935ac416d
commit 9e50edb281
1 changed files with 4 additions and 3 deletions

View File

@ -670,6 +670,7 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
new("ClientId", info.ClientId),
new("UserId", info.UserId),
new("UserName", info.UserName),
new("DeviceSn", info.DeviceSn),
new("ConnectTime", info.ConnectTime.ToString("O")),
new("IsLock", info.IsLock ? "true" : "false")
});
@ -723,13 +724,13 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
[AllowAnonymous]
public async Task<List<MqttClientResp>> GetLockedDeviceClients()
{
var userIds = await _cache.SetMembersAsync("locked_devices");
var deviceSns = await _cache.SetMembersAsync("locked_devices");
var result = new List<MqttClientResp>();
foreach (var userId in userIds)
foreach (var deviceSn in deviceSns)
{
var entries = await _cache.HashGetAllAsync($"client:{userId}");
var entries = await _cache.HashGetAllAsync($"client:{deviceSn}");
if (entries.Length > 0)
result.Add(ParseClient(entries));
}