Merge branch 'master' of https://e.coding.net/rosydev/baseapi
This commit is contained in:
@@ -188,8 +188,8 @@ func (a *API) MiniProgramSortLink() (string, error) {
|
||||
|
||||
bodyJson := map[string]interface{}{
|
||||
//"access_token ": weChatToken,
|
||||
"expire_type ": 1,
|
||||
"expire_time": 1,
|
||||
"expire_type": 1,
|
||||
"expire_interval": 1,
|
||||
}
|
||||
body, _ := json.Marshal(bodyJson)
|
||||
result, err := a.AccessAPI("wxa/generate_urllink", parmaJson, string(body))
|
||||
@@ -197,7 +197,8 @@ func (a *API) MiniProgramSortLink() (string, error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if result["errcode"] != 0 {
|
||||
errCode, _ := result["errcode"].(json.Number).Int64()
|
||||
if errCode != 0 {
|
||||
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)
|
||||
} else {
|
||||
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.
|
||||
return request
|
||||
|
||||
Reference in New Issue
Block a user