Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerry committed May 27, 2019
1 parent f5e3179 commit b60e239
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 5 additions & 3 deletions wechat_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func TestMd5(t *testing.T) {
}

func TestCode2Session(t *testing.T) {
userIdRsp, err := Code2Session(AppID, APPSecret, "011q70AD06npij2RsnxD08V8AD0q70Aw")
userIdRsp, err := Code2Session(AppID, APPSecret, "081fuZyJ1wqYE20z15yJ15T2zJ1fuZyd")
if err != nil {
fmt.Println("err:", err)
return
Expand All @@ -302,7 +302,8 @@ func TestGetAccessToken(t *testing.T) {
}

func TestGetPaidUnionId(t *testing.T) {
rsp, err := GetPaidUnionId("21_xtheVOuysOja3u-v1pqmEnvpfcnXKcLVLsMzhUcJfanrhzzwpIsaTJgPe0oqbN-ETK6Ugsf0LmGjMTi4flgSdCRgheCj2WuMm6VCqlSmsf6Itu_BFfoh0wYeiMAwvP9pYSH3wJbIzXQdUzOqKRXcAGAYFL", "o0Df70MSI4Ygv2KQ2cLnoMN5CXI8", "4200000326201905256499385970")
accessToken := "21_3puo3mxoK6Ry2bR7Dh-qdn41wUP1wClwke8Zhf9a_i39jfWRq9rhNJZZZHaOt_Yad-Gp6u9_46dGW0RbIMz3nANInRI3m-1glvCnGW47v63sjYWV1iyTKOHGwDVxEv78kY-0OfkmkiIveVqAZCZaAAAQTQ"
rsp, err := GetPaidUnionId(accessToken, "o0Df70MSI4Ygv2KQ2cLnoMN5CXI8", "4200000326201905256499385970")
if err != nil {
fmt.Println("err:", err)
return
Expand All @@ -313,7 +314,8 @@ func TestGetPaidUnionId(t *testing.T) {
}

func TestGetWeChatUserInfo(t *testing.T) {
userInfo, err := GetWeChatUserInfo("21_duf5flUtcHrORmBVTUrP3pJILBi13YBPrf2T9PJ5_Nykc-78jXYZf2HRDDFO-o8zD85Wte8hIhBRj9kz852IYVXHn9VzmOtveZuXsovUSpwHwKv96lKqU1tzweXib8HGvamPMqNVbJC_8WtdNVDgAIAIQY", OpenID)
accessToken := "21_3puo3mxoK6Ry2bR7Dh-qdn41wUP1wClwke8Zhf9a_i39jfWRq9rhNJZZZHaOt_Yad-Gp6u9_46dGW0RbIMz3nANInRI3m-1glvCnGW47v63sjYWV1iyTKOHGwDVxEv78kY-0OfkmkiIveVqAZCZaAAAQTQ"
userInfo, err := GetWeChatUserInfo(accessToken, OpenID)
if err != nil {
fmt.Println("err:", err)
return
Expand Down
2 changes: 1 addition & 1 deletion wechat_rsp.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ type WeChatUserInfo struct {
Language string `json:"language"` //用户的语言,简体中文为zh_CN
City string `json:"city"` //用户所在城市
Province string `json:"province"` //用户所在省份
Country string `json:"country"` // 用户所在国家
Country string `json:"country"` //用户所在国家
Headimgurl string `json:"headimgurl"` //用户头像,最后一个数值代表正方形头像大小(有0、46、64、96、132数值可选,0代表640*640正方形头像),用户没有头像时该项为空。若用户更换头像,原有头像URL将失效。
SubscribeTime int `json:"subscribe_time"` //用户关注时间,为时间戳。如果用户曾多次关注,则取最后关注时间
Unionid string `json:"unionid"` //只有在用户将公众号绑定到微信开放平台帐号后,才会出现该字段。
Expand Down
2 changes: 0 additions & 2 deletions wechat_servier_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"github.com/parnurzeal/gorequest"
"reflect"
"strings"
Expand Down Expand Up @@ -206,7 +205,6 @@ func GetWeChatUserInfo(accessToken, openId string, lang ...string) (userInfo *We
} else {
url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=" + accessToken + "&openid=" + openId + "&lang=zh_CN"
}
fmt.Println(url)
agent := HttpAgent()
_, _, errs := agent.Get(url).EndStruct(userInfo)
if len(errs) > 0 {
Expand Down

0 comments on commit b60e239

Please sign in to comment.