Merge pull request '权限管理功能小改' (#287) from koy07555/Admin.NET.Pro:小改权限相关 into v2
Reviewed-on: https://code.adminnet.top/Admin.NET/Admin.NET.Pro/pulls/287
This commit is contained in:
commit
3d50990047
@ -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