- when retry for jddj api, use different timestamp to distinguish request

This commit is contained in:
gazebo
2019-02-26 21:11:34 +08:00
parent 0fa014a74f
commit 6d6eee7b09
2 changed files with 4 additions and 4 deletions

View File

@@ -157,12 +157,12 @@ func (a *API) AccessAPI(apiStr string, jdParams map[string]interface{}) (retVal
userGet = false
}
params["jd_param_json"] = jdParamStr
params["timestamp"] = utils.GetCurTimeStr()
sign := a.signParams(params)
params[signKey] = sign
err = platformapi.AccessPlatformAPIWithRetry(a.client,
func() *http.Request {
params["timestamp"] = utils.GetCurTimeStr()
sign := a.signParams(params)
params[signKey] = sign
var request *http.Request
if userGet {
fullURL := utils.GenerateGetURL(prodURL, apiStr, params)

View File

@@ -141,7 +141,7 @@ func AccessPlatformAPIWithRetry(client *http.Client, handleRequest func() *http.
var errLevel string
bodyMap, err := utils.HTTPResponse2Json(response)
if err != nil {
errLevel = ErrLevelGeneralFail //ErrLevelRecoverableErr // 为了配合京东到家排查返回HTML的错误,禁止重试
errLevel = ErrLevelRecoverableErr // 京东到家偶尔会返回HTML重试
} else {
errLevel, err = handleResponse(bodyMap)
}