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);