优化查询用户详细信息

This commit is contained in:
不做码农 2022-01-05 21:58:48 +08:00
parent 2a14724473
commit 9a813cced3

View File

@ -70,13 +70,14 @@ namespace ZR.Admin.WebApi.Controllers.System
{
Dictionary<string, object> dic = new();
var roles = RoleService.SelectRoleAll();
dic.Add("roles", roles);
dic.Add("roles", SysUser.IsAdmin(userId) ? roles : roles.FindAll(f => !f.IsAdmin()));
dic.Add("posts", PostService.GetAll());
//编辑
if (userId > 0)
{
dic.Add("user", UserService.SelectUserById(userId));
SysUser sysUser = UserService.SelectUserById(userId);
dic.Add("user", sysUser);
dic.Add("postIds", UserPostService.GetUserPostsByUserId(userId));
dic.Add("roleIds", RoleService.SelectUserRoles(userId));
}