From 80f45e3a3ed913dc1c8c6f7644f256a4f6b109d6 Mon Sep 17 00:00:00 2001 From: panliang <1163816051@qq.com> Date: Thu, 16 Feb 2023 14:56:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=E5=85=81=E8=AE=B8?= =?UTF-8?q?=E6=B7=B7=E5=90=88=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Admin/Controllers/Store/StoreController.php | 1 + app/Services/OrderService.php | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/Admin/Controllers/Store/StoreController.php b/app/Admin/Controllers/Store/StoreController.php index a9cbcb5a..6917f8f1 100644 --- a/app/Admin/Controllers/Store/StoreController.php +++ b/app/Admin/Controllers/Store/StoreController.php @@ -121,6 +121,7 @@ class StoreController extends AdminController $form->image('image') ->required() ->move('store/'.Carbon::now()->toDateString()) + ->uniqueName() ->saveFullUrl() ->removable(false) ->retainable() diff --git a/app/Services/OrderService.php b/app/Services/OrderService.php index e890b0b1..a7e1aa6f 100644 --- a/app/Services/OrderService.php +++ b/app/Services/OrderService.php @@ -891,11 +891,12 @@ class OrderService // 可使用优惠券的商品总额 $amounts = []; + $pass = false; foreach ($products as $item) { $sku = $item['sku']; - if (! $coupon->isSupport($sku)) { - throw new BizException('优惠券不满足使用条件'); + if ($coupon->isSupport($sku)) { + $pass = true; } $amount = $item['total_amount'] - $item['vip_discount_amount']; @@ -906,6 +907,10 @@ class OrderService } } + if (!$pass) { + throw new BizException('优惠券不满足使用条件'); + } + // 全部商品总额 $totalAmount = array_sum($amounts);