- refactor cancel waybill reason.

This commit is contained in:
gazebo
2018-08-08 14:20:25 +08:00
parent 702aac1b00
commit 8bb1badb2c
2 changed files with 5 additions and 6 deletions

View File

@@ -128,7 +128,7 @@ func (c *WaybillController) CreateWaybill(order *model.GoodsOrder) (err error) {
func (c *WaybillController) CancelWaybill(bill *model.Waybill) (err error) {
reasonID := dadaapi.ReasonIDOther
reasonMsg := "other reason"
reasonMsg := "send not in time"
if bill.Status < model.WaybillStatusAccepted {
reasonID = dadaapi.ReasonIDNobodyAccept
reasonMsg = "ReasonIDNobodyAccept"

View File

@@ -237,15 +237,14 @@ func (c *WaybillController) CreateWaybill(order *model.GoodsOrder) (err error) {
}
func (c *WaybillController) CancelWaybill(bill *model.Waybill) (err error) {
reasonID := mtpsapi.CancelReasonMerchantOther
reasonMsg := "other reason"
reasonID := mtpsapi.CancelReasonRidderSendNotIntime
reasonMsg := "CancelReasonRidderSendNotIntime"
if bill.Status < model.WaybillStatusAccepted {
reasonID = mtpsapi.CancelReasonMerchantOther
reasonMsg = "nobody accept order"
} else if bill.Status < model.WaybillStatusCourierArrived {
reasonID = mtpsapi.CancelReasonRideerGetGoodNotIntime
reasonMsg = "CancelReasonRideerGetGoodNotIntime"
} else {
reasonID = mtpsapi.CancelReasonRidderSendNotIntime
reasonMsg = "CancelReasonRidderSendNotIntime"
}
_, err = api.MtpsAPI.CancelOrder(utils.Str2Int64(bill.VendorWaybillID2), bill.VendorWaybillID, reasonID, reasonMsg)
return nil