This commit is contained in:
laodaming 2023-11-24 12:06:00 +08:00
parent dbf39e3057
commit 681ec8269c

View File

@ -34,16 +34,15 @@ func NewGetLdapOrganizationsLogic(ctx context.Context, svcCtx *svc.ServiceContex
// func (l *GetLdapOrganizationsLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) { // func (l *GetLdapOrganizationsLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
// } // }
type DNItem struct { type DNItem struct {
Attribute map[string]interface{} `json:"attribute"` MemberCount int `json:"member_count"`
MemberCount int `json:"member_count"` BusinessCategory string `json:"business_category"`
BusinessCategory string `json:"business_category"` OwnerName string `json:"owner_name"`
OwnerName string `json:"owner_name"` OwnerDN string `json:"owner_dn"`
OwnerDN string `json:"owner_dn"` Level int `json:"level"`
Level int `json:"level"` DepartmentDN string `json:"department_dn"`
DepartmentDN string `json:"department_dn"` DepartmentParentDN string `json:"department_parent_dn"`
DepartmentParentDN string `json:"department_parent_dn"` Sort int `json:"sort"`
Sort int `json:"sort"` Child []*DNItem `json:"child"`
Child []*DNItem `json:"child"`
} }
func (l *GetLdapOrganizationsLogic) GetLdapOrganizations(req *types.Request, r *http.Request) (resp *basic.Response) { func (l *GetLdapOrganizationsLogic) GetLdapOrganizations(req *types.Request, r *http.Request) (resp *basic.Response) {
@ -73,7 +72,6 @@ func (l *GetLdapOrganizationsLogic) GetLdapOrganizations(req *types.Request, r *
ownerDN := "" ownerDN := ""
for _, v := range searchResult.Entries { for _, v := range searchResult.Entries {
sortNum++ sortNum++
attribute := make(map[string]interface{})
memberCount := 0 //成员数 memberCount := 0 //成员数
businessCategory := "" //部门名称 businessCategory := "" //部门名称
for _, attr := range v.Attributes { for _, attr := range v.Attributes {
@ -99,7 +97,6 @@ func (l *GetLdapOrganizationsLogic) GetLdapOrganizations(req *types.Request, r *
BusinessCategory: businessCategory, BusinessCategory: businessCategory,
Level: level, Level: level,
MemberCount: memberCount, MemberCount: memberCount,
Attribute: attribute,
OwnerDN: ownerDN, OwnerDN: ownerDN,
Sort: sortNum, Sort: sortNum,
Child: make([]*DNItem, 0, 100), Child: make([]*DNItem, 0, 100),