From a5191440c6514a39654826497711806fbdcc1f20 Mon Sep 17 00:00:00 2001 From: Edward Yang Date: Sat, 11 Feb 2023 09:29:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B8=B8=E5=AE=A2=E7=BB=93?= =?UTF-8?q?=E8=B4=A6=E5=AE=A2=E6=88=B7=E7=BB=84=E6=8A=98=E6=89=A3=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TotalServices/CustomerDiscountService.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/beike/Shop/Services/TotalServices/CustomerDiscountService.php b/beike/Shop/Services/TotalServices/CustomerDiscountService.php index e32134a5..4847032d 100644 --- a/beike/Shop/Services/TotalServices/CustomerDiscountService.php +++ b/beike/Shop/Services/TotalServices/CustomerDiscountService.php @@ -22,10 +22,14 @@ class CustomerDiscountService public static function getTotal(CheckoutService $checkout) { $totalService = $checkout->totalService; + $customer = current_customer(); + if (empty($customer)) { + return null; + } - $discountFactor = current_customer()->customerGroup->discount_factor; + $discountFactor = $customer->customerGroup->discount_factor; if ($discountFactor <= 0) { - return; + return null; } if ($discountFactor > 1) { $discountFactor = 1;