- purchase platform, cancel waybill added.
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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)"`
|
||||
|
||||
Reference in New Issue
Block a user