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