BUG:删除缓存后不重启服务会登陆不了
FIX:对API列表进行排序,方便排查权限时快带定位
This commit is contained in:
parent
5bbf1cf45e
commit
c1de3b2987
@ -59,7 +59,13 @@ public class SysAuthService : IDynamicApiController, ITransient
|
||||
if (passwordErrorTimes > passwordMaxErrorTimes) throw Oops.Oh(ErrorCodeEnum.D1027);
|
||||
|
||||
// 判断是否开启验证码并校验
|
||||
var tenant = _sysCacheService.Get<List<SysTenant>>(CacheConst.KeyTenant)?.WhereIF(input.TenantId > 0, u => u.Id == input.TenantId).FirstOrDefault();
|
||||
var tenant = _sysCacheService.Get<List<SysTenant>>(CacheConst.KeyTenant)?.WhereIF(input.TenantId > 0, u => u.Id == input.TenantId).FirstOrDefault();
|
||||
// 缓存被清服务不重启这里tenant会为空,出错
|
||||
if (tenant==null && input.TenantId==0)
|
||||
{
|
||||
await App.GetRequiredService<SysTenantService>().CacheTenant();
|
||||
tenant = _sysCacheService.Get<List<SysTenant>>(CacheConst.KeyTenant)?.WhereIF(input.TenantId > 0, u => u.Id == input.TenantId).FirstOrDefault();
|
||||
}
|
||||
if (tenant.Captcha == true && !_captcha.Validate(input.CodeId.ToString(), input.Code))
|
||||
throw Oops.Oh(ErrorCodeEnum.D0008);
|
||||
|
||||
|
||||
@ -393,7 +393,9 @@ public class SysRoleService : IDynamicApiController, ITransient
|
||||
var roleApiList = await _sysRoleApiService.GetRoleApiList(roleIdList);
|
||||
apiList[1].AddRange(roleApiList);
|
||||
}
|
||||
_sysCacheService.Set(CacheConst.KeyUserApi + userId, apiList, TimeSpan.FromDays(7)); // 缓存7天
|
||||
_sysCacheService.Set(CacheConst.KeyUserApi + userId, apiList, TimeSpan.FromDays(7)); // 缓存7天
|
||||
foreach (var lst in apiList)
|
||||
lst.Sort();
|
||||
return apiList;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user