- 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

@@ -57,7 +57,7 @@ func (c *WaybillController) callbackMsg2Waybill(msg *dadaapi.CallbackMsg) (retVa
return retVal
}
//
// DeliveryPlatformHandler
func (c *WaybillController) CreateWaybill(order *model.GoodsOrder) (err error) {
billParams := &dadaapi.OperateOrderRequiredParams{
ShopNo: utils.Int2Str(order.StoreID), // 当前达达的门店号与京西是一样的
@@ -81,5 +81,15 @@ func (c *WaybillController) CreateWaybill(order *model.GoodsOrder) (err error) {
}
func (c *WaybillController) CancelWaybill(bill *model.Waybill) (err error) {
return nil
reasonID := dadaapi.ReasonIDOther
reasonMsg := "other reason"
if bill.Status < model.WaybillStatusAccepted {
reasonID = dadaapi.ReasonIDNobodyAccept
reasonMsg = "ReasonIDNobodyAccept"
} else if bill.Status < model.WaybillStatusCourierArrived {
reasonID = dadaapi.ReasonIDNobodyPickup
reasonMsg = "ReasonIDNobodyPickup"
}
_, err = api.DadaAPI.CancelOrder(bill.VendorWaybillID, reasonID, reasonMsg)
return err
}

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
}

View File

@@ -81,7 +81,7 @@ type Waybill struct {
VendorOrderID string `orm:"column(vendor_order_id);size(48)"`
OrderVendorID int `orm:"column(order_vendor_id)"`
VendorWaybillID string `orm:"column(vendor_waybill_id);size(48)"`
VendorWaybillID2 string `orm:"column(vendor_waybill_id2);size(48)"`
VendorWaybillID2 string `orm:"column(vendor_waybill_id2);size(48)"` // 某些平台有多个ID比如美团配送当前美团配送的 delivery_id存这里
WaybillVendorID int `orm:"column(waybill_vendor_id)"`
CourierName string `orm:"size(32)"`
CourierMobile string `orm:"size(32)"`