- handle error when getting order info.
This commit is contained in:
@@ -179,8 +179,8 @@ func newOrder(order *jdapi.JDOrderMsg) error {
|
|||||||
|
|
||||||
data := result["data"].(map[string]interface{})
|
data := result["data"].(map[string]interface{})
|
||||||
dataResult := data["result"].(map[string]interface{})
|
dataResult := data["result"].(map[string]interface{})
|
||||||
resultList := dataResult["resultList"].([]interface{})
|
resultList, ok := dataResult["resultList"].([]interface{})
|
||||||
if len(resultList) == 1 {
|
if ok && len(resultList) == 1 {
|
||||||
resultList0 := resultList[0].(map[string]interface{})
|
resultList0 := resultList[0].(map[string]interface{})
|
||||||
orderStatus, _ := resultList0["orderStatus"].(json.Number).Int64()
|
orderStatus, _ := resultList0["orderStatus"].(json.Number).Int64()
|
||||||
rec.OrderStatus = int(orderStatus)
|
rec.OrderStatus = int(orderStatus)
|
||||||
@@ -230,6 +230,7 @@ func normalOrderStatus(order *jdapi.JDOrderMsg) error {
|
|||||||
rec.OrderStatusTime = order.Timestamp
|
rec.OrderStatusTime = order.Timestamp
|
||||||
err = freshFoodAPI.JDOrderStatus(rec, "0")
|
err = freshFoodAPI.JDOrderStatus(rec, "0")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
// todo 这里应该要加一个重试机制
|
||||||
sugarLogger.Warnf("access freshfood failed, error:%v", err)
|
sugarLogger.Warnf("access freshfood failed, error:%v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user