From f2032b3f30228959f8b4c1348dfef1ead4f38b3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 15 Jul 2022 09:47:19 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=80=E8=BF=98=E6=89=A3=E9=99=A4=E8=BF=90?= =?UTF-8?q?=E5=8D=95=E8=B4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 14 +++++++++----- business/jxcallback/scheduler/basesch/basesch.go | 8 ++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index b0376d35d..b35f40236 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -485,14 +485,18 @@ func ResetCreateWaybillFee(db *dao.DaoDB, order *model.GoodsOrder) (err error) { } } - if !isRefund { - return err + if !isRefund { // 骑手已经到店了,无法退款 + globals.SugarLogger.Debug("Refund Money Fail:", "骑手已到店,无法退款") + return errors.New("骑手已到店,无法退款") } // 获取品牌的支付记录 - orderBill, _ := dao.GetBrandBill(db, store.BrandID, order.VendorOrderID, model.BrandBillTypeExpend, model.BrandBillFeeTypeDelivery, order.VendorWaybillID) - if len(orderBill) != model.YES { - return errors.New("订单支出数据异常,应该为一条数据") + orderBill, _ := dao.GetBrandBill(db, store.BrandID, order.VendorOrderID, 0, model.BrandBillFeeTypeDelivery, order.VendorWaybillID) + for _, v := range orderBill { + if v.BillType == model.BrandBillTypeIncome { // 已经退款了 + globals.SugarLogger.Debug("Refund Money Fail:", "同一订单无法重复退款") + return errors.New("无法重复退款") + } } // 将支出记录修改为退款记录,支付类型为收入,且类型为三方配送时:退费 diff --git a/business/jxcallback/scheduler/basesch/basesch.go b/business/jxcallback/scheduler/basesch/basesch.go index 93b01a334..560c4263b 100644 --- a/business/jxcallback/scheduler/basesch/basesch.go +++ b/business/jxcallback/scheduler/basesch/basesch.go @@ -240,11 +240,11 @@ func (c *BaseScheduler) CancelWaybill(bill *model.Waybill, cancelReasonID int, c if handlerInfo := partner.GetDeliveryPlatformFromVendorID(bill.WaybillVendorID); handlerInfo != nil { if err = utils.CallFuncLogErrorWithInfo(func() error { if err := handlerInfo.Handler.CancelWaybill(bill, cancelReasonID, cancelReason); err != nil { - globals.SugarLogger.Debug("=================正儿八经去平台取消订单") - order, _ := partner.CurOrderManager.LoadOrder(bill.VendorOrderID, bill.OrderVendorID) - orderman.ResetCreateWaybillFee(nil, order) + return err } - return err + globals.SugarLogger.Debug("=================正儿八经去平台取消订单") + order, _ := partner.CurOrderManager.LoadOrder(bill.VendorOrderID, bill.OrderVendorID) + return orderman.ResetCreateWaybillFee(nil, order) }, "CancelWaybill bill:%v", bill); err == nil { bill.Status = model.WaybillStatusCanceled bill.DeliveryFlag |= model.WaybillDeliveryFlagMaskActiveCancel