|
|
@ -47,6 +47,8 @@ public class AuthService : IAuthService, IDynamicApiController, ITransient
|
|
|
|
|
|
|
|
|
|
|
|
private readonly ILogger<AuthService> _logger;
|
|
|
|
private readonly ILogger<AuthService> _logger;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private readonly SqlSugarRepository<PingTaiUser> _pingtaiUser; // 平台用户
|
|
|
|
|
|
|
|
|
|
|
|
public AuthService(SqlSugarRepository<SysUser> sysUserRep, SqlSugarRepository<SysLogVis> sysLogVisRep, SqlSugarRepository<SysTenant> sysTenantRep,
|
|
|
|
public AuthService(SqlSugarRepository<SysUser> sysUserRep, SqlSugarRepository<SysLogVis> sysLogVisRep, SqlSugarRepository<SysTenant> sysTenantRep,
|
|
|
|
IHttpContextAccessor httpContextAccessor, ISysCacheService cache,
|
|
|
|
IHttpContextAccessor httpContextAccessor, ISysCacheService cache,
|
|
|
|
ISysEmpService sysEmpService, ISysRoleService sysRoleService, ISysMenuService sysMenuService,
|
|
|
|
ISysEmpService sysEmpService, ISysRoleService sysRoleService, ISysMenuService sysMenuService,
|
|
|
@ -515,7 +517,14 @@ public class AuthService : IAuthService, IDynamicApiController, ITransient
|
|
|
|
var datainfo = _sysUserRep.AsQueryable().Filter(null, true).First(u => u.DjyUserId == data.UserId);
|
|
|
|
var datainfo = _sysUserRep.AsQueryable().Filter(null, true).First(u => u.DjyUserId == data.UserId);
|
|
|
|
|
|
|
|
|
|
|
|
//获取缓存的权限,将权限缓存
|
|
|
|
//获取缓存的权限,将权限缓存
|
|
|
|
await _cache.SetAsync(datainfo.UserCode, data.Authority);
|
|
|
|
//如果类型为公司,将公司下所有用户关联出
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (data.AuthorityType == 2)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
data.Authority = _pingtaiUser.Where(t => data.Authority.Contains(t.CompId)).Select(t => t.GID).ToList();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await _cache.SetAsync(datainfo.UserCode + "Authorization", data.Authority);
|
|
|
|
|
|
|
|
|
|
|
|
//获取对应租户
|
|
|
|
//获取对应租户
|
|
|
|
var tenant = _sysTenantRep.Single(datainfo.TenantId);
|
|
|
|
var tenant = _sysTenantRep.Single(datainfo.TenantId);
|
|
|
|