|
@@ -15,7 +15,7 @@ import (
|
|
|
)
|
|
|
|
|
|
const (
|
|
|
- baseURL = "https://api.weixin.qq.com"
|
|
|
+ baseURL = "https://api.weixin.qq.com1"
|
|
|
codeAPI = "/sns/jscode2session"
|
|
|
)
|
|
|
const (
|
|
@@ -92,14 +92,18 @@ func (cli *Client) Login(code string) (wxUser WxUser, err error) {
|
|
|
}
|
|
|
//请求微信接口
|
|
|
res, err := cli.client.Get(api)
|
|
|
- defer func(Body io.ReadCloser) {
|
|
|
- Body.Close()
|
|
|
- }(res.Body)
|
|
|
if err != nil || res.StatusCode != 200 {
|
|
|
- logger.Error("获取微信用户信息失败:%v", res.Status)
|
|
|
+ if res != nil {
|
|
|
+ logger.Error("获取微信用户信息失败:%v", res.Status)
|
|
|
+ } else {
|
|
|
+ logger.Error("获取微信用户信息失败:%v", err)
|
|
|
+ }
|
|
|
err = exception.New(exception.WeChatServerError)
|
|
|
return
|
|
|
}
|
|
|
+ defer func(Body io.ReadCloser) {
|
|
|
+ Body.Close()
|
|
|
+ }(res.Body)
|
|
|
var data loginResponse
|
|
|
err = json.NewDecoder(res.Body).Decode(&data)
|
|
|
if err != nil {
|