1
This commit is contained in:
@@ -188,8 +188,8 @@ func (a *API) MiniProgramSortLink() (string, error) {
|
|||||||
|
|
||||||
bodyJson := map[string]interface{}{
|
bodyJson := map[string]interface{}{
|
||||||
//"access_token ": weChatToken,
|
//"access_token ": weChatToken,
|
||||||
"expire_type ": 1,
|
"expire_type": 1,
|
||||||
"expire_time": 1,
|
"expire_interval": 1,
|
||||||
}
|
}
|
||||||
body, _ := json.Marshal(bodyJson)
|
body, _ := json.Marshal(bodyJson)
|
||||||
result, err := a.AccessAPI("wxa/generate_urllink", parmaJson, string(body))
|
result, err := a.AccessAPI("wxa/generate_urllink", parmaJson, string(body))
|
||||||
@@ -197,7 +197,8 @@ func (a *API) MiniProgramSortLink() (string, error) {
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
if result["errcode"] != 0 {
|
errCode, _ := result["errcode"].(json.Number).Int64()
|
||||||
|
if errCode != 0 {
|
||||||
return "", errors.New(result["errmsg"].(string))
|
return "", errors.New(result["errmsg"].(string))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,6 +102,9 @@ func (a *API) AccessAPI(action string, params map[string]interface{}, body strin
|
|||||||
request, _ = http.NewRequest(http.MethodGet, fullURL, nil)
|
request, _ = http.NewRequest(http.MethodGet, fullURL, nil)
|
||||||
} else {
|
} else {
|
||||||
request, _ = http.NewRequest(http.MethodPost, fullURL, strings.NewReader(body))
|
request, _ = http.NewRequest(http.MethodPost, fullURL, strings.NewReader(body))
|
||||||
|
if strings.Contains(fullURL, "wxa/generate_urllink") {
|
||||||
|
request.Header.Set("Content-Type", "application/json")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
request.Close = true // todo try to fix EOF error when accessing weixin api.
|
request.Close = true // todo try to fix EOF error when accessing weixin api.
|
||||||
return request
|
return request
|
||||||
|
|||||||
Reference in New Issue
Block a user