fix: 修复飞书根部门用户获取问题 (#88)

This commit is contained in:
二丫讲梵 2022-07-19 11:47:37 +08:00 committed by GitHub
parent 0bdefa9484
commit 458cf59e06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -57,11 +57,18 @@ func GetAllUsers() (ret []map[string]interface{}, err error) {
if err != nil {
return nil, err
}
deptids := make([]string, 0)
deptids = append(deptids, "0") // 0 代表根部门
for _, dept := range depts {
deptids = append(deptids, dept["open_department_id"].(string))
}
for _, deptid := range deptids {
req := lark.GetUserListReq{
PageSize: &pageSize,
PageToken: new(string),
DepartmentID: dept["open_department_id"].(string),
DepartmentID: deptid,
}
for {
res, _, err := InitFeiShuClient().Contact.GetUserList(context.Background(), &req)