- refactor platformapi.AccessPlatformAPIWithRetry
This commit is contained in:
@@ -159,11 +159,7 @@ func (a *API) AccessAPI(action string, params map[string]interface{}) (retVal *R
|
||||
return request
|
||||
},
|
||||
a.config,
|
||||
func(response *http.Response) (result string, err error) {
|
||||
jsonResult1, err := utils.HTTPResponse2Json(response)
|
||||
if err != nil {
|
||||
return platformapi.ErrLevelGeneralFail, err
|
||||
}
|
||||
func(jsonResult1 map[string]interface{}) (result string, err error) {
|
||||
resultError, _ := jsonResult1["error"].(map[string]interface{})
|
||||
retVal = &ResponseResult{
|
||||
ID: jsonResult1["id"].(string),
|
||||
@@ -220,11 +216,7 @@ func (a *API) AcccessAPI2(baseURL string, params map[string]interface{}, method
|
||||
return request
|
||||
},
|
||||
a.config,
|
||||
func(response *http.Response) (result string, err error) {
|
||||
jsonResult1, err := utils.HTTPResponse2Json(response)
|
||||
if err != nil {
|
||||
return platformapi.ErrLevelGeneralFail, err
|
||||
}
|
||||
func(jsonResult1 map[string]interface{}) (result string, err error) {
|
||||
retVal = jsonResult1
|
||||
return platformapi.ErrLevelSuccess, nil
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user