作者 唐旭辉

数据输出调整

@@ -55,18 +55,22 @@ func FilterRoleAll(adminid int64, companyid int64, list []protocol.RoleBase) []p @@ -55,18 +55,22 @@ func FilterRoleAll(adminid int64, companyid int64, list []protocol.RoleBase) []p
55 log.Error(e.Error()) 55 log.Error(e.Error())
56 return newlist 56 return newlist
57 } 57 }
58 - if companyInfo.AdminId == adminid {  
59 - return list  
60 - }  
61 for _, v := range list { 58 for _, v := range list {
62 if v.IsDefault == models.ROLE_DEFAULR && v.Types == models.ROLETYPES_GROUP { 59 if v.IsDefault == models.ROLE_DEFAULR && v.Types == models.ROLETYPES_GROUP {
63 admingoroupId = v.Id 60 admingoroupId = v.Id
  61 + break
64 } 62 }
65 } 63 }
66 for k, v := range list { 64 for k, v := range list {
67 - if v.Id == admingoroupId || v.ParentId == admingoroupId { 65 + if v.Types == models.ROLETYPES_ROLE && v.IsDefault == models.ROLE_DEFAULR {
68 continue 66 continue
69 } 67 }
  68 + if companyInfo.AdminId != adminid {
  69 + //非主管理员
  70 + if v.Id == admingoroupId || v.ParentId == admingoroupId {
  71 + continue
  72 + }
  73 + }
70 74
71 newlist = append(newlist, list[k]) 75 newlist = append(newlist, list[k])
72 } 76 }
@@ -140,7 +140,7 @@ func RoleEdit(param protocol.RequestRoleEdit) (*protocol.ResponseRoleInfo, error @@ -140,7 +140,7 @@ func RoleEdit(param protocol.RequestRoleEdit) (*protocol.ResponseRoleInfo, error
140 var oldParent *models.Role 140 var oldParent *models.Role
141 oldParent, err = models.GetRoleById(param.Pid) 141 oldParent, err = models.GetRoleById(param.Pid)
142 if err != nil { 142 if err != nil {
143 - log.Error("获取父级数据失败;%s", err) 143 + log.Error("获取父级数据失败;%s", err)
144 return nil, protocol.NewErrWithMessage("1") 144 return nil, protocol.NewErrWithMessage("1")
145 } 145 }
146 if yes := oldParent.IsDefaultRole(); yes { 146 if yes := oldParent.IsDefaultRole(); yes {