Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions apis.md.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/apis.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,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)

`execUserDetail`|`reqUserDetail`|`respUserDetail`|+|`POST //cgi-bin/user/getuserdetail`|[获取访问用户敏感信息](https://developer.work.weixin.qq.com/document/path/95833)
# 部门管理

## API calls
Expand Down
7 changes: 6 additions & 1 deletion errcodes/mod.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions models.go
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,22 @@ func (x reqUserInfoGet) intoURLValues() url.Values {
}
}

// reqUserDetail 获取成员详情
type reqUserDetail struct {
UserTicket string `json:"user_ticket"`
}

var _ bodyer = reqUserDetail{}

func (x reqUserDetail) intoBody() ([]byte, error) {
return marshalIntoJSONBody(x)
}

type respUserDetail struct {
respCommon
UserSensitiveInfo
}

// respUserInfoGet 部门列表响应
type respUserInfoGet struct {
respCommon
Expand Down
23 changes: 23 additions & 0 deletions user_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ type UserDetail struct {
// TODO: extattr external_profile external_position
}

// UserSensitiveInfo 用户敏感信息
type UserSensitiveInfo struct {
Userid string `json:"userid"`
Gender string `json:"gender"`
Avatar string `json:"avatar"`
QrCode string `json:"qr_code"`
Mobile string `json:"mobile"`
Email string `json:"email"`
BizMail string `json:"biz_mail"`
Address string `json:"address"`
}

// GetUser 读取成员
func (c *WorkwxApp) GetUser(userid string) (*UserInfo, error) {
resp, err := c.execUserGet(reqUserGet{
Expand Down Expand Up @@ -138,3 +150,14 @@ func (c *WorkwxApp) GetUserInfoByCode(code string) (*UserIdentityInfo, error) {
}
return &resp.UserIdentityInfo, nil
}

// GetUserDetail 获取用户敏感信息
func (c *WorkwxApp) GetUserDetail(userTicket string) (*UserSensitiveInfo, error) {
resp, err := c.execUserDetail(reqUserDetail{
UserTicket: userTicket,
})
if err != nil {
return nil, err
}
return &resp.UserSensitiveInfo, nil
}