- big refactor for scheduler.

This commit is contained in:
gazebo
2018-07-25 20:43:41 +08:00
parent f3df85c8e0
commit c0770e9ab5
16 changed files with 515 additions and 321 deletions

View File

@@ -158,6 +158,11 @@ func (c *OrderController) GetOrder(orderID string) (order *model.GoodsOrder, err
Skus: []*model.OrderSku{},
}
order.Status = c.GetStatusFromVendorStatus(order.VendorStatus)
if result["book"].(bool) {
order.BusinessType = model.BusinessTypeDingshida
} else {
order.BusinessType = model.BusinessTypeImmediate
}
deliveryGeo := strings.Split(utils.Interface2String(result["deliveryGeo"]), ",")
if len(deliveryGeo) == 2 {
order.CoordinateType = model.CoordinateTypeMars
@@ -273,8 +278,11 @@ func (c *OrderController) SelfDeliverDelievered(order *model.GoodsOrder) (err er
return api.ElmAPI.CompleteDeliveryBySelf(order.VendorOrderID, order.ConsigneeMobile)
}
func (c *OrderController) GetStatusActionConfig(status int) *scheduler.StatusActionConfig {
return &scheduler.StatusActionConfig{
Timeout: acceptOrderDelay, // 饿了么没有拣货状态,接单后就为拣货完成,所以要延迟接单,否则门店来不及备货
func (c *OrderController) GetStatusActionConfig(statusType, status int) *scheduler.StatusActionConfig {
if statusType == scheduler.TimerStatusTypeOrder && status == model.OrderStatusNew {
return &scheduler.StatusActionConfig{
Timeout: acceptOrderDelay, // 饿了么没有拣货状态,接单后就为拣货完成,所以要延迟接单,否则门店来不及备货
}
}
return nil
}

View File

@@ -23,7 +23,7 @@ func (c *WaybillController) OnWaybillStatusMsg(msg *elmapi.CallbackWaybillStatus
func (c *WaybillController) onWaybillStatusMsg(msg *elmapi.CallbackWaybillStatusMsg) (retVal *elmapi.CallbackResponse) {
order := c.callbackMsg2Waybill(msg)
if msg.MsgType == elmapi.MsgTypeWaybillWait4DeliveryVendor {
if msg.MsgType == elmapi.MsgTypeWaybillWait4Courier { //MsgTypeWaybillWait4Courier事件与JD的新运单事件的时间机制更相似
order.Status = model.WaybillStatusNew
} else if msg.MsgType == elmapi.MsgTypeWaybillPickingUp {
if result, err := api.ElmAPI.GetOrder(msg.OrderID); err == nil {