- 修改AccessPlatformAPIWithRetry接口,允许处理返回结果为非JSON请求
This commit is contained in:
@@ -115,7 +115,10 @@ func (a *API) AccessAPI(cmd string, body map[string]interface{}) (retVal *Respon
|
||||
return request
|
||||
},
|
||||
a.config,
|
||||
func(response *http.Response, jsonResult1 map[string]interface{}) (result 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")
|
||||
}
|
||||
Body := jsonResult1["body"].(map[string]interface{})
|
||||
retVal = &ResponseResult{
|
||||
ErrNo: int(utils.MustInterface2Int64(Body["errno"])),
|
||||
|
||||
@@ -344,7 +344,10 @@ func (a *API) AccessStorePage2(subURL string, params map[string]interface{}, isP
|
||||
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["errno"]))
|
||||
if code == ResponseCodeSuccess {
|
||||
@@ -591,7 +594,10 @@ func (a *API) AccessStorePageNoCookie(subURL string, params 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")
|
||||
}
|
||||
code := int(utils.MustInterface2Int64(jsonResult1["error_no"]))
|
||||
if code == ResponseCodeSuccess {
|
||||
retVal = jsonResult1["result"].(map[string]interface{})
|
||||
|
||||
Reference in New Issue
Block a user