From 2ac71873634264dde003e39ef98610171f640577 Mon Sep 17 00:00:00 2001 From: richboo111 Date: Wed, 28 Dec 2022 15:46:40 +0800 Subject: [PATCH] 1 --- .../partner/delivery/tiktok_store/waybill.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/business/partner/delivery/tiktok_store/waybill.go b/business/partner/delivery/tiktok_store/waybill.go index f56f56be3..e188a75f1 100644 --- a/business/partner/delivery/tiktok_store/waybill.go +++ b/business/partner/delivery/tiktok_store/waybill.go @@ -2,6 +2,7 @@ package tiktok_store import ( "errors" + "fmt" "git.rosy.net.cn/baseapi/platformapi/mtpsapi" shop_getStoreDetail_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_getStoreDetail/request" superm_createVirtualMobile_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/superm_createVirtualMobile/response" @@ -109,10 +110,17 @@ func (c *DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee } func (c *DeliveryHandler) CancelWaybill(bill *model.Waybill, cancelReasonID int, cancelReason string) (err error) { - err = getAPI(bill.VendorOrgCode).CancelPlatformPickUp(utils.Str2Int64(bill.VendorWaybillID)) - bill.Status = model.WaybillStatusCanceled - bill.Remark = cancelReason - partner.CurOrderManager.OnWaybillStatusChanged(bill) + if localOrder, _, err := dao.GetOrders(dao.GetDB(), []int64{utils.Str2Int64(bill.VendorOrderID)}, false, false, "", "", false, []int{0}, false, "", nil, 0, 0); err != nil { + return errors.New("取消运单时,获取平台门店ID失败,请重试") + } else { + if err = getAPI(bill.VendorOrgCode).ShopOrderDispatcher(utils.Str2Int64(localOrder[0].VendorStoreID), bill.VendorOrderID, tiktok_api.DispatcherFeeTypeCancel); err != nil { + globals.SugarLogger.Debugf("抖音配送取消运力失败:%v", err) + return fmt.Errorf("抖音配送取消运力失败:%v", err) + } + bill.Status = model.WaybillStatusCanceled + bill.Remark = cancelReason + partner.CurOrderManager.OnWaybillStatusChanged(bill) + } globals.SugarLogger.Debugf("DYPS CancelWaybill bill.Status=%d err=%v", bill.Status, err) return err }