- change all request to NewRequest, don't use bare Request{}.

- MessageTemplateSend added.
- refactor weixin api.
This commit is contained in:
gazebo
2018-07-20 13:39:11 +08:00
parent dd45e6b31a
commit fda5f8e0ed
6 changed files with 82 additions and 62 deletions

View File

@@ -5,7 +5,6 @@ import (
"encoding/json"
"fmt"
"net/http"
"net/url"
"sort"
"git.rosy.net.cn/baseapi"
@@ -147,12 +146,7 @@ func (a *API) AccessAPI(apiStr string, jdParams map[string]interface{}) (retVal
params["timestamp"] = utils.GetCurTimeStr()
sign := a.signParams(params)
params[signKey] = sign
finalURL, _ := url.Parse(utils.GenerateGetURL(prodURL, apiStr, params))
request := &http.Request{
Method: "GET",
URL: finalURL,
}
request, _ := http.NewRequest(http.MethodGet, utils.GenerateGetURL(prodURL, apiStr, params), nil)
err = platformapi.AccessPlatformAPIWithRetry(a.client, request, a.config, func(response *http.Response) (errLevel string, err error) {
jsonResult1, err := utils.HTTPResponse2Json(response)
if err != nil {