- 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

@@ -4,7 +4,6 @@ import (
"crypto/md5"
"fmt"
"net/http"
"net/url"
"sort"
"strings"
@@ -101,11 +100,7 @@ func (a *API) AccessAPI(apiStr string, params map[string]interface{}) (retVal Re
params2 := utils.MergeMaps(utils.Params2Map("key", a.key, "output", "json"), params)
params2[signKey] = a.signParams(params2)
finalURL, _ := url.Parse(utils.GenerateGetURL(prodURL, apiStr, params2))
request := &http.Request{
Method: "GET",
URL: finalURL,
}
request, _ := http.NewRequest(http.MethodGet, utils.GenerateGetURL(prodURL, apiStr, params2), 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 {