diff --git a/apis.md.go b/apis.md.go index 941f6ce..95c8a4c 100644 --- a/apis.md.go +++ b/apis.md.go @@ -145,6 +145,17 @@ func (c *WorkwxApp) execUserIDByEmail(req reqUserIDByEmail) (respUserIDByEmail, return resp, nil } +// execUserGetDetail 获取访问用户敏感信息 +func (c *WorkwxApp) execUserGetDetail(req reqAuthTicket2UserInfo) (respUserGet, error) { + var resp respUserGet + err := executeQyapiJSONPost(c, "/cgi-bin/user/getuserdetail", req, &resp, true) + if err != nil { + return respUserGet{}, err + } + + return resp, nil +} + // execDeptCreate 创建部门 func (c *WorkwxApp) execDeptCreate(req reqDeptCreate) (respDeptCreate, error) { var resp respDeptCreate diff --git a/docs/apis.md b/docs/apis.md index 35b32e1..19ca2c2 100644 --- a/docs/apis.md +++ b/docs/apis.md @@ -30,6 +30,7 @@ Name|Request Type|Response Type|Access Token|URL|Doc `execUserJoinQrcode`|`reqUserJoinQrcode`|`respUserJoinQrcode`|+|`GET /cgi-bin/corp/get_join_qrcode`|[获取加入企业二维码](https://developer.work.weixin.qq.com/document/path/91714) `execUserIDByMobile`|`reqUserIDByMobile`|`respUserIDByMobile`|+|`POST /cgi-bin/user/getuserid`|[手机号获取userid](https://work.weixin.qq.com/api/doc/90001/90143/91693) `execUserIDByEmail`|`reqUserIDByEmail`|`respUserIDByEmail`|+|`POST /cgi-bin/user/get_userid_by_email`|[邮箱获取userid](https://developer.work.weixin.qq.com/document/path/95895) +`execUserGetDetail`|`reqAuthTicket2UserInfo`|`respUserGet`|+|`POST /cgi-bin/user/getuserdetail`|[获取访问用户敏感信息](https://developer.work.weixin.qq.com/document/path/95833) # 部门管理 diff --git a/models.go b/models.go index 79a72c7..1190b34 100644 --- a/models.go +++ b/models.go @@ -774,6 +774,15 @@ type AuthCodeUserInfo struct { ExternalUserID string `json:"external_userid,omitempty"` } +// reqAuthTicket2UserInfo 获取访问用户敏感信息 +type reqAuthTicket2UserInfo struct { + UserTicket string `json:"user_ticket,omitempty"` +} + +func (x reqAuthTicket2UserInfo) intoBody() ([]byte, error) { + return marshalIntoJSONBody(x) +} + type reqMsgAuditListPermitUser struct { MsgAuditEdition MsgAuditEdition `json:"type"` } diff --git a/user_info.go b/user_info.go index 4beb0e0..d97cc2d 100644 --- a/user_info.go +++ b/user_info.go @@ -38,6 +38,20 @@ func (c *WorkwxApp) GetUser(userid string) (*UserInfo, error) { return &obj, nil } +func (c *WorkwxApp) GetUserDetail(ticket string) (*UserInfo, error) { + resp, err := c.execUserGetDetail(reqAuthTicket2UserInfo{ + UserTicket: ticket, + }) + if err != nil { + return nil, err + } + obj, err := resp.intoUserInfo() + if err != nil { + return nil, err + } + return &obj, nil +} + // UpdateUser 更新成员 func (c *WorkwxApp) UpdateUser(userDetail *UserDetail) error { _, err := c.execUserUpdate(reqUserUpdate{