作者 唐旭辉

数据输出格式修改

... ... @@ -40,7 +40,7 @@ type ResponseDepartmentInfo struct {
ID int64 `json:"id"`
CompanyID int64 `json:"company_id"` //公司
Name string `json:"name"` //部门名字
ParantID int64 `json:"parentId"` //父级部门Id
ParantID int64 `json:"parent_id"` //父级部门Id
Manages []DepartmentManager `json:"manages"` //部门管理员
Members []DepartmentMember `json:"members"` //部门成员
Member int64 `json:"member"` //成员数
... ...
... ... @@ -181,29 +181,31 @@ func RoleGroupDelete(param protocol.RequestRoleDelete) error {
return nil
}
func GetRoleList(companyId int64) ([]protocol.RoleInfo, error) {
func GetRoleList(companyId int64) ([]protocol.RoleGroup, error) {
var (
roleGroups []protocol.RoleInfo
roleGroups []protocol.RoleGroup
err error
rolesReturn []protocol.RoleInfo
groups []protocol.RoleInfo
)
roleGroups, err = getRoleGroupByCompany(companyId)
groups, err = getRoleGroupByCompany(companyId)
if err != nil {
log.Error("getRoleGroupByCompany err:%s", err)
return rolesReturn, protocol.NewErrWithMessage("1")
return roleGroups, protocol.NewErrWithMessage("1")
}
for _, v := range roleGroups {
for k, v := range groups {
var roles []protocol.RoleInfo
roles, err = getRoleInfoByPid(companyId, v.Id)
if err != nil {
log.Error("getRoleInfoByPid err:%s", err)
continue
return roleGroups, protocol.NewErrWithMessage("1")
}
rolesReturn = append(rolesReturn, roles...)
rolegroup := protocol.RoleGroup{
RoleInfo: groups[k],
Roles: roles,
}
roleGroups = append(roleGroups, rolegroup)
}
rolesReturn = append(rolesReturn, roleGroups...)
return rolesReturn, nil
return roleGroups, nil
}
func getRoleInfoByPid(companyid int64, pid int64) ([]protocol.RoleInfo, error) {
... ...