mirror of
https://github.com/silenceper/wechat.git
synced 2026-02-04 12:52:27 +08:00
企业微信-欢迎语素材管理,企业微信-获取成员ID列表 (#629)
* 企业微信-客户联系-统计管理 * 企业微信-客户联系-统计管理 * 企业微信-客户联系-统计管理 * debug * rollback * debug * debug * 获取用户信息 * token * json.Marshal错误输出 * debug * bugfix * 企业微信-通讯录管理相关接口 * 企业微信-通讯录管理 * 企业微信-通讯录管理 * 企业微信-通讯录管理 * 企业微信-[联系我]方式新增和查询 * 企业微信-[联系我]方式新增和获取 * 企业微信-[联系我]方式更新 * 企业微信-[联系我]方式列表、删除 * json.Marshal错误输出 * 已实现接口bug修改 * 历史接口bugfix * 历史接口bugfix * comment * 企业微信:客户联系-消息推送;素材管理-上传图片 * fix * 企业微信-获取群发记录列表 * 历史接口bugfix * 1.企业微信-客户联系-消息推送-入群欢迎语素材管理 2.企业微信-通讯录管理-成员管理-获取成员ID列表 * golangci-lint * gofmt * 方法访问命名 Co-authored-by: wang.yu <wangyu@uniondrug.com>
This commit is contained in:
@@ -11,6 +11,8 @@ const (
|
||||
UserSimpleListURL = "https://qyapi.weixin.qq.com/cgi-bin/user/simplelist?access_token=%s&department_id=%d"
|
||||
// UserGetURL 读取成员
|
||||
UserGetURL = "https://qyapi.weixin.qq.com/cgi-bin/user/get?access_token=%s&userid=%s"
|
||||
// UserListIDURL 获取成员ID列表
|
||||
UserListIDURL = "https://qyapi.weixin.qq.com/cgi-bin/user/list_id?access_token=%s"
|
||||
)
|
||||
|
||||
type (
|
||||
@@ -133,3 +135,43 @@ func (r *Client) UserGet(UserID string) (*UserGetResponse, error) {
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// UserListIDRequest 获取成员ID列表请求
|
||||
type UserListIDRequest struct {
|
||||
Cursor string `json:"cursor"`
|
||||
Limit int `json:"limit"`
|
||||
}
|
||||
|
||||
// UserListIDResponse 获取成员ID列表响应
|
||||
type UserListIDResponse struct {
|
||||
util.CommonError
|
||||
NextCursor string `json:"next_cursor"`
|
||||
DeptUser []*DeptUser `json:"dept_user"`
|
||||
}
|
||||
|
||||
// DeptUser 用户-部门关系
|
||||
type DeptUser struct {
|
||||
UserID string `json:"userid"`
|
||||
Department int `json:"department"`
|
||||
}
|
||||
|
||||
// UserListID 获取成员ID列表
|
||||
// see https://developer.work.weixin.qq.com/document/path/96067
|
||||
func (r *Client) UserListID(req *UserListIDRequest) (*UserListIDResponse, error) {
|
||||
var (
|
||||
accessToken string
|
||||
err error
|
||||
)
|
||||
if accessToken, err = r.GetAccessToken(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var response []byte
|
||||
if response, err = util.PostJSON(fmt.Sprintf(UserListIDURL, accessToken), req); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result := &UserListIDResponse{}
|
||||
if err = util.DecodeWithError(response, result, "UserListID"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user