diff --git a/platformapi/weixinapi/sns.go b/platformapi/weixinapi/sns.go index 05dfb7a6..44a4afb6 100644 --- a/platformapi/weixinapi/sns.go +++ b/platformapi/weixinapi/sns.go @@ -2,7 +2,6 @@ package weixinapi import ( "bytes" - "fmt" "git.rosy.net.cn/baseapi/utils" ) @@ -139,20 +138,19 @@ func (a *API) SNSCode2Session(jsCode string) (sessionInfo *SessionInfo, err erro } func (a *API) SNSGetUserPhone(jsCode string) (string, error) { - url := "wxa/business/getuserphonenumber?access_token=%s" + url := "wxa/business/getuserphonenumber" if a.token == "" { a.CBRetrieveToken() - url = fmt.Sprintf(url, a.CBGetToken()) - } else { - url = fmt.Sprintf(url, a.token) } - result, err := a.AccessAPI(url, map[string]interface{}{ - "js_code": jsCode, - }, "1") + bodyJson := map[string]interface{}{ + "code": jsCode, + } + + result, err := a.AccessAPI(url, nil, string(utils.MustMarshal(bodyJson))) if err != nil { return "", err } - if result["errcode"].(int) != 0 { + if result["errcode"].(string) != "" { return "", err } var phoneInfo *UserPhone