From 8629c94c2cc3d8677ea0d1fc144110df7c80188a Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Tue, 28 Dec 2021 17:46:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=87=91=E9=A2=9D=E4=B8=BA0?= =?UTF-8?q?=E7=9A=84=E5=95=86=E5=93=81=E6=97=A0=E6=B3=95=E5=8F=91=E8=B5=B7?= =?UTF-8?q?=E9=80=80=E6=AC=BE=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/AfterSaleService.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Services/AfterSaleService.php b/app/Services/AfterSaleService.php index 3d3b42fc..f16929ab 100644 --- a/app/Services/AfterSaleService.php +++ b/app/Services/AfterSaleService.php @@ -49,6 +49,10 @@ class AfterSaleService $amount = ($num == $orderProduct->quantity) ? $orderProduct->total_amount : bcmul(bcdiv($orderProduct->total_amount, $orderProduct->quantity), $num); + if ($amount == 0 && in_array($params['type'], [AfterSale::TYPE_REFUND])) { + throw new BizException('实际支付金额为0的商品无法发起退款售后'); + } + $afterSale = AfterSale::create(array_merge($params, [ 'user_id' => $user->id, 'order_id' => $orderProduct->order_id,