This commit is contained in:
richboo111
2022-12-28 15:46:40 +08:00
parent 647b7062af
commit 2ac7187363

View File

@@ -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
}