This commit is contained in:
tongfei
2024-04-18 14:33:25 +08:00
parent a79893ffb5
commit a23321e1d2
6 changed files with 53 additions and 14 deletions

View File

@@ -8,6 +8,8 @@ namespace WMS.Web.Domain.IService.Public
{
bool CanAccessMethod(string cacheKey);
bool GetRedisKeyValue(string cacheKey);
void UpdateAccessStatus(string cacheKey, bool canAccess);
}
}

View File

@@ -17,13 +17,21 @@ namespace WMS.Web.Domain.Services.Public
public bool CanAccessMethod(string cacheKey)
{
// 使用 Redis 来存储并发控制标记
return _redisClientService.SetStringKey(cacheKey, "true", TimeSpan.FromMinutes(1));
return _redisClientService.SetStringKey<bool>(cacheKey, true, TimeSpan.FromMinutes(1));
}
public bool GetRedisKeyValue(string cacheKey)
{
// 使用 Redis 来存储并发控制标记
var isSuccess= _redisClientService.GetStringKey<bool>(cacheKey);
return isSuccess;
}
public void UpdateAccessStatus(string cacheKey, bool canAccess)
{
// 更新 Redis 缓存项的值
_redisClientService.SetStringKey(cacheKey, canAccess.ToString(), TimeSpan.FromMinutes(1));
_redisClientService.SetStringKey<bool>(cacheKey, canAccess, TimeSpan.FromMinutes(1));
}
}
}

View File

@@ -24,6 +24,8 @@ namespace WMS.Web.Domain.Values
public static ValueTuple<int, string> NoDateError = (40005, "数据不存在");
public static ValueTuple<int, string> SourceBillNoDateError = (40005, "来源单不存在,请核对后再试");
public static ValueTuple<int, string> Concurrent_Instock = (80005, "该任务单正在处理中");
/// <summary>
/// 没有菜单权限,无法登录
/// </summary>