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,