- purchase platform, cancel waybill added.

This commit is contained in:
gazebo
2018-07-15 09:57:29 +08:00
parent 805925ff58
commit de2545c3e2
3 changed files with 25 additions and 4 deletions

View File

@@ -78,7 +78,7 @@ func (c *WaybillController) callbackMsg2Waybill(msg *mtpsapi.CallbackOrderMsg) (
return retVal
}
//
// DeliveryPlatformHandler
func (c *WaybillController) CreateWaybill(order *model.GoodsOrder) (err error) {
db := orm.NewOrm()
// 忽略坐标转换错误,即使是转换出错,也只能当成转换成功来处理,底层会有错误日志输出
@@ -119,6 +119,17 @@ func (c *WaybillController) CreateWaybill(order *model.GoodsOrder) (err error) {
}
func (c *WaybillController) CancelWaybill(bill *model.Waybill) (err error) {
reasonID := mtpsapi.CancelReasonMerchantOther
reasonMsg := "other reason"
if bill.Status < model.WaybillStatusAccepted {
} 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
}