diff --git a/wechat_client_test.go b/wechat_client_test.go index 4384121f..121a031a 100644 --- a/wechat_client_test.go +++ b/wechat_client_test.go @@ -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 @@ -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 @@ -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 diff --git a/wechat_rsp.go b/wechat_rsp.go index 1ab908ba..547d8cf6 100644 --- a/wechat_rsp.go +++ b/wechat_rsp.go @@ -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"` //只有在用户将公众号绑定到微信开放平台帐号后,才会出现该字段。 diff --git a/wechat_servier_api.go b/wechat_servier_api.go index e4cf97ac..b2b3f6eb 100644 --- a/wechat_servier_api.go +++ b/wechat_servier_api.go @@ -17,7 +17,6 @@ import ( "encoding/hex" "encoding/json" "errors" - "fmt" "github.com/parnurzeal/gorequest" "reflect" "strings" @@ -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 {