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;