优化角色信息查询
This commit is contained in:
parent
4cb7296767
commit
3fee68d504
@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Http;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using ZR.Admin.WebApi.Filters;
|
using ZR.Admin.WebApi.Filters;
|
||||||
using ZR.Common;
|
using ZR.Common;
|
||||||
using ZR.Model;
|
using ZR.Model;
|
||||||
@ -66,7 +67,8 @@ namespace ZR.Admin.WebApi.Controllers.System
|
|||||||
{
|
{
|
||||||
Dictionary<string, object> dic = new();
|
Dictionary<string, object> dic = new();
|
||||||
var roles = RoleService.SelectRoleAll();
|
var roles = RoleService.SelectRoleAll();
|
||||||
dic.Add("roles", SysUser.IsAdmin(userId) ? roles : roles.FindAll(f => !f.IsAdmin()));
|
dic.Add("roles", roles);
|
||||||
|
//dic.Add("roles", SysUser.IsAdmin(userId) ? roles : roles.FindAll(f => !f.IsAdmin()));
|
||||||
dic.Add("posts", PostService.GetAll());
|
dic.Add("posts", PostService.GetAll());
|
||||||
|
|
||||||
//编辑
|
//编辑
|
||||||
@ -75,7 +77,7 @@ namespace ZR.Admin.WebApi.Controllers.System
|
|||||||
SysUser sysUser = UserService.SelectUserById(userId);
|
SysUser sysUser = UserService.SelectUserById(userId);
|
||||||
dic.Add("user", sysUser);
|
dic.Add("user", sysUser);
|
||||||
dic.Add("postIds", UserPostService.GetUserPostsByUserId(userId));
|
dic.Add("postIds", UserPostService.GetUserPostsByUserId(userId));
|
||||||
dic.Add("roleIds", RoleService.SelectUserRoles(userId));
|
dic.Add("roleIds", sysUser.RoleIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ToResponse(ApiResult.Success(dic));
|
return ToResponse(ApiResult.Success(dic));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user