aa
This commit is contained in:
@@ -110,7 +110,7 @@ func method2ResponseKey(method string) (responseKey string) {
|
||||
return responseKey
|
||||
}
|
||||
|
||||
func (a *API) AccessAPI(method string, params, bizContent map[string]interface{}) (retVal map[string]interface{}, err error) {
|
||||
func (a *API) AccessAPI(method string, params, bizContent map[string]interface{}, isPost bool) (retVal map[string]interface{}, err error) {
|
||||
params = utils.MergeMaps(map[string]interface{}{
|
||||
"app_id": a.GetAppID(),
|
||||
"method": method,
|
||||
@@ -126,11 +126,16 @@ func (a *API) AccessAPI(method string, params, bizContent map[string]interface{}
|
||||
|
||||
err = platformapi.AccessPlatformAPIWithRetry(a.client,
|
||||
func() *http.Request {
|
||||
var request *http.Request
|
||||
params["timestamp"] = utils.GetCurTimeStr()
|
||||
params[signKey] = a.signParams(params)
|
||||
fullURL := utils.GenerateGetURL(prodURL, "", params)
|
||||
request, _ := http.NewRequest(http.MethodGet, fullURL, nil)
|
||||
// request, _ := http.NewRequest(http.MethodPost, prodURL, bytes.NewReader(utils.MustMarshal(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
|
||||
},
|
||||
a.config,
|
||||
|
||||
Reference in New Issue
Block a user