ArtisanCloud/PowerWeChat

fail to get userdetail by user_ticket

sdxstar opened this issue · 3 comments

`
// 获取访问用户敏感信息
// https://developer.work.weixin.qq.com/document/path/95833
func (provider *WeCom) GetUserDetail(userTicket string) (*weCom.ResponseGetUserDetail, error) {

result := &weCom.ResponseGetUserDetail{}
strAPIAccessToken, err := provider.GetAPIAccessToken()
if err != nil {
	return nil, err
}

params := &object.HashMap{
	"user_ticket": userTicket,
}
query := &object.StringMap{
	"access_token": strAPIAccessToken,
}

client, err := provider.GetHttpClient()
if err != nil {
	return nil, err
}

err = client.Df().Url("https://qyapi.weixin.qq.com/cgi-bin/auth/getuserinfo").
	Method("POST").
	Json(&object.HashMap{
		"form_params": params,
		"query":       query,
	}).Result(result)
if err != nil {
	return nil, err
}

return result, err

}
should change to
// 获取访问用户敏感信息
// https://developer.work.weixin.qq.com/document/path/95833
func (provider *WeCom) GetUserDetail(userTicket string) (*weCom.ResponseGetUserDetail, error) {

result := &weCom.ResponseGetUserDetail{}
strAPIAccessToken, err := provider.GetAPIAccessToken()
if err != nil {
	return nil, err
}

params := &object.HashMap{
	"user_ticket": userTicket,
}

client, err := provider.GetHttpClient()
if err != nil {
	return nil, err
}

err = client.Df().Url("https://qyapi.weixin.qq.com/cgi-bin/auth/getuserdetail").
	Method("POST").
	Query("access_token", strAPIAccessToken).
	Json(params).Result(result)
if err != nil {
	return nil, err
}

return result, err

}
`

我替换好了,等我另一个issue调整完后,一起发布

Please check v3.0.21

thx, it fixed.