美团外卖API,不管有无错误,都尝试取得数据(因为有出错,但有有效数据返回的情况),比如ecommerce/order/getOrderIdByDaySeq

This commit is contained in:
gazebo
2020-01-02 09:13:32 +08:00
parent b98fbb9b83
commit 0de719a0ba

View File

@@ -169,6 +169,12 @@ func (a *API) AccessAPI2(cmd string, isGet bool, bizParams map[string]interface{
if jsonResult1 == nil {
return platformapi.ErrLevelRecoverableErr, fmt.Errorf("mapData is nil")
}
// 不管有无错误都尝试取得数据因为有出错但有有效数据返回的情况比如ecommerce/order/getOrderIdByDaySeq
if resultKey != "" {
retVal = jsonResult1[resultKey]
} else {
retVal = jsonResult1
}
if errObj, ok := jsonResult1["error"]; ok {
baseapi.SugarLogger.Debugf("mtwm AccessAPI failed, jsonResult1:%s", utils.Format4Output(jsonResult1, true))
errorInfo := errObj.(map[string]interface{})
@@ -179,10 +185,6 @@ func (a *API) AccessAPI2(cmd string, isGet bool, bizParams map[string]interface{
return platformapi.ErrLevelRecoverableErr, newErr
}
return platformapi.ErrLevelCodeIsNotOK, newErr
} else if resultKey != "" {
retVal = jsonResult1[resultKey]
} else {
retVal = jsonResult1
}
return platformapi.ErrLevelSuccess, nil
})