|
@@ -430,6 +430,27 @@ func (this *UserAuthController) Info() {
|
|
|
br.ErrMsg = "查询失败,系统异常,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
+ private, err := services.GetPrivateChartPermissionList()
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "查询失败"
|
|
|
+ br.ErrMsg = "查询失败,系统异常,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if private.Ret != 200 {
|
|
|
+ br.Msg = private.Msg
|
|
|
+ br.ErrMsg = private.ErrMsg
|
|
|
+ return
|
|
|
+ }
|
|
|
+ userPermissionIds, err := models.GetChartPermissionIdByUserId(user.UserId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "查看权限失败"
|
|
|
+ br.ErrMsg = "查看权限失败,系统异常,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ userPermissionMap := make(map[int]struct{})
|
|
|
+ for _, v := range userPermissionIds {
|
|
|
+ userPermissionMap[v] = struct{}{}
|
|
|
+ }
|
|
|
if seller == nil {
|
|
|
// 添加默认的销售电话
|
|
|
seller = &models.SysUser{
|
|
@@ -437,6 +458,18 @@ func (this *UserAuthController) Info() {
|
|
|
AreaCode: utils.DefaultAreaCode,
|
|
|
}
|
|
|
}
|
|
|
+ var hasPermission string
|
|
|
+ for _, v := range private.Data {
|
|
|
+ for _, vv := range v.Child {
|
|
|
+ if _, ok := userPermissionMap[vv.ChartPermissionId]; ok {
|
|
|
+ hasPermission = "私有权限"
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if hasPermission == "" {
|
|
|
+ hasPermission = "公有权限"
|
|
|
+ }
|
|
|
|
|
|
userView := &models.UserView{
|
|
|
Headimgurl: user.Headimgurl,
|
|
@@ -446,6 +479,7 @@ func (this *UserAuthController) Info() {
|
|
|
SellerName: seller.SysRealName,
|
|
|
SellerPhone: seller.Phone,
|
|
|
SellerAreaCode: seller.AreaCode,
|
|
|
+ HasPermission: hasPermission,
|
|
|
Email: user.Email,
|
|
|
Componey: user.Company,
|
|
|
IsRegistered: user.IsRegistered,
|