处理京东page在有些post请求时,返回的不同格式

This commit is contained in:
gazebo
2019-12-02 18:28:44 +08:00
parent 4ff3de2ef9
commit 4133454e46

View File

@@ -341,9 +341,17 @@ func (a *API) AccessStorePage2(fullURL string, params map[string]interface{}, is
return platformapi.ErrLevelSuccess, nil
}
retVal = jsonResult1
var errMsg string
code, ok := jsonResult1["code"].(string)
if !ok {
return platformapi.ErrLevelGeneralFail, utils.NewErrorCode(utils.Format4Output(jsonResult1, true), "999")
if statusMap, ok := jsonResult1["status"].(map[string]interface{}); !ok {
return platformapi.ErrLevelGeneralFail, utils.NewErrorCode(utils.Format4Output(jsonResult1, true), "999")
} else {
code = utils.Interface2String(statusMap["errorCode"])
errMsg = utils.Interface2String(statusMap["message"])
}
} else {
errMsg = utils.Interface2String(jsonResult1["msg"])
}
if code == ResponseCodeSuccess {
if resultKey != "" {
@@ -351,7 +359,7 @@ func (a *API) AccessStorePage2(fullURL string, params map[string]interface{}, is
}
return platformapi.ErrLevelSuccess, nil
}
newErr := utils.NewErrorCode(jsonResult1["msg"].(string), code)
newErr := utils.NewErrorCode(errMsg, code)
if _, ok := pageExceedLimitCodes[code]; ok {
return platformapi.ErrLevelExceedLimit, newErr
} else if _, ok := pageCanRetryCodes[code]; ok {