- 修改AccessPlatformAPIWithRetry接口,允许处理返回结果为非JSON请求
This commit is contained in:
@@ -152,7 +152,10 @@ func (a *API) AccessAPI2(cmd string, isGet bool, bizParams map[string]interface{
|
||||
return request
|
||||
},
|
||||
a.config,
|
||||
func(response *http.Response, jsonResult1 map[string]interface{}) (errLevel string, err error) {
|
||||
func(response *http.Response, bodyStr string, jsonResult1 map[string]interface{}) (errLevel string, err error) {
|
||||
if jsonResult1 == nil {
|
||||
return platformapi.ErrLevelRecoverableErr, fmt.Errorf("mapData is nil")
|
||||
}
|
||||
if errObj, ok := jsonResult1["error"]; ok {
|
||||
baseapi.SugarLogger.Debugf("mtwm AccessAPI failed, jsonResult1:%s", utils.Format4Output(jsonResult1, true))
|
||||
errorInfo := errObj.(map[string]interface{})
|
||||
|
||||
@@ -77,7 +77,10 @@ func (a *API) AccessUserPage(subURL string, params map[string]interface{}) (retV
|
||||
return request
|
||||
},
|
||||
a.config,
|
||||
func(response *http.Response, jsonResult1 map[string]interface{}) (errLevel string, err error) {
|
||||
func(response *http.Response, bodyStr string, jsonResult1 map[string]interface{}) (errLevel string, err error) {
|
||||
if jsonResult1 == nil {
|
||||
return platformapi.ErrLevelRecoverableErr, fmt.Errorf("mapData is nil")
|
||||
}
|
||||
retVal = jsonResult1
|
||||
code := int(utils.MustInterface2Int64(jsonResult1["code"]))
|
||||
if code == ResponseCodeSuccess {
|
||||
|
||||
Reference in New Issue
Block a user