- empty scheduler added.

This commit is contained in:
gazebo
2018-07-12 20:53:22 +08:00
parent 1c6ba2e43a
commit 52248ca427
13 changed files with 338 additions and 238 deletions

View File

@@ -12,10 +12,6 @@ import (
type WaybillController struct {
}
func init() {
controller.WaybillManager.RegisterDeliveryProvider(controller.VendorIDELM, new(WaybillController))
}
func (c *WaybillController) OnWaybillStatusMsg(msg *elmapi.CallbackWaybillStatusMsg) (retVal *elmapi.CallbackResponse) {
controller.CallMsgHandler(func() {
retVal = c.onWaybillStatusMsg(msg)
@@ -26,25 +22,25 @@ 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 {
order.Status = controller.WaybillStatusNew
order.Status = model.WaybillStatusNew
} else if msg.MsgType == elmapi.MsgTypeWaybillPickingUp {
order.Status = controller.WaybillStatusAccepted
order.Status = model.WaybillStatusAccepted
} else if msg.MsgType == elmapi.MsgTypeWaybillCourierArrived {
order.Status = controller.WaybillStatusCourierArrived
order.Status = model.WaybillStatusCourierArrived
} else if msg.MsgType == elmapi.MsgTypeWaybillDelivering {
order.Status = controller.WaybillStatusDelivering
order.Status = model.WaybillStatusDelivering
} else if msg.MsgType == elmapi.MsgTypeWaybillDelivered {
order.Status = controller.WaybillStatusDelivered
order.Status = model.WaybillStatusDelivered
} else if msg.MsgType >= elmapi.MsgTypeWaybillCanceledByMerchant && msg.MsgType <= elmapi.MsgTypeWaybillCanceledBySystem {
order.Status = controller.WaybillStatusCanceled
order.Status = model.WaybillStatusCanceled
} else if msg.MsgType >= elmapi.MsgTypeWaybillFailedCallLate &&
msg.MsgType <= elmapi.MsgTypeRejectedSystemError &&
msg.MsgType != elmapi.MsgTypeDeiverBySelf {
order.Status = controller.WaybillStatusFailed
order.Status = model.WaybillStatusFailed
} else {
// MsgTypeWait4Courier
// MsgTypeDeiverBySelf
order.Status = controller.WaybillStatusUnknown
order.Status = model.WaybillStatusUnknown
}
return elmapi.Err2CallbackResponse(controller.WaybillManager.OnWaybillStatusChanged(order), order.VendorStatus)
}
@@ -52,9 +48,9 @@ func (c *WaybillController) onWaybillStatusMsg(msg *elmapi.CallbackWaybillStatus
func (c *WaybillController) callbackMsg2Waybill(msg *elmapi.CallbackWaybillStatusMsg) (retVal *model.Waybill) {
retVal = &model.Waybill{
VendorOrderID: msg.OrderID,
OrderVendorID: controller.VendorIDELM,
OrderVendorID: model.VendorIDELM,
VendorWaybillID: msg.OrderID,
WaybillVendorID: controller.VendorIDELM,
WaybillVendorID: model.VendorIDELM,
CourierName: msg.Name,
CourierMobile: msg.Phone,
VendorStatus: c.composeState(msg.State, msg.SubState, elmapi.MsgTypeWaybillWait4DeliveryVendor),