This commit is contained in:
邹宗楠
2022-07-11 10:36:40 +08:00
parent 1fde23f531
commit 6cf1ea3337
15 changed files with 99 additions and 64 deletions

View File

@@ -119,6 +119,7 @@ func (a *API) AccessAPI(method string, params, bizContent map[string]interface{}
"sign_type": "RSA2",
"version": "1.0",
}, params)
if len(bizContent) > 0 {
params["biz_content"] = string(utils.MustMarshal(bizContent))
}
@@ -128,12 +129,12 @@ func (a *API) AccessAPI(method string, params, bizContent map[string]interface{}
var request *http.Request
params["timestamp"] = utils.GetCurTimeStr()
params[signKey] = a.signParams(params)
fullURL := utils.GenerateGetURL(prodURL, "", params)
if isPost {
request, _ = http.NewRequest(http.MethodPost, prodURL, strings.NewReader(utils.Map2URLValues(params).Encode()))
} else {
request, _ = http.NewRequest(http.MethodGet, fullURL, nil)
}
return request
},