添加企业微信查询所有企业工作人员信息
This commit is contained in:
@@ -47,7 +47,8 @@ func (a *API) CreateAppChat(param *CreateAppChatParamReq) error {
|
||||
// 获取所有的部门列表
|
||||
func (a *API) GetAllDepartmentList() ([]*Department, error) {
|
||||
a.CheckAccessTokenExpiresIn()
|
||||
data, err := a.AccessAPI(WeChatBaseApi, GetAllDepartmentListById, http.MethodGet, map[string]interface{}{"access_token": a.accessToken})
|
||||
param := map[string]interface{}{"access_token": a.accessToken}
|
||||
data, err := a.AccessAPI(WeChatBaseApi, GetAllDepartmentListById, http.MethodGet, param)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -62,25 +63,6 @@ func (a *API) GetAllDepartmentList() ([]*Department, error) {
|
||||
return result.Department, nil
|
||||
}
|
||||
|
||||
// 获取企业部门用户详细情况
|
||||
func (a *API) GetEnterpriseStaffInfo(department int) ([]*UserList, error) {
|
||||
a.CheckAccessTokenExpiresIn()
|
||||
departmentUserDetail, err := a.AccessAPI(WeChatBaseApi, GetDepartmentUserDetail, http.MethodGet, map[string]interface{}{"department_id": department, "fetch_child": 0})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result := &GetEnterpriseStaffInfoRes{}
|
||||
if err := utils.Map2StructByJson(departmentUserDetail, result, false); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if result.ErrCode != 0 {
|
||||
return nil, errors.New(result.ErrMsg)
|
||||
}
|
||||
|
||||
return result.UserList, nil
|
||||
}
|
||||
|
||||
// 通过手机号获取用户消息
|
||||
func (a *API) GetUserIdByMobile(mobile string) (string, error) {
|
||||
a.CheckAccessTokenExpiresIn()
|
||||
|
||||
Reference in New Issue
Block a user