From f2d7f76ab951ae3b7c8ce42a965bb40740ab5f0a Mon Sep 17 00:00:00 2001 From: Edward Yang Date: Sat, 11 Feb 2023 20:37:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=87=E7=AB=A0=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B=E6=95=B0=E4=B8=BA=E7=A9=BA=E4=BF=9D=E5=AD=98=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- beike/Admin/Repositories/PageRepo.php | 8 ++++---- beike/Plugin/Plugin.php | 2 ++ .../Services/TotalServices/CustomerDiscountService.php | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/beike/Admin/Repositories/PageRepo.php b/beike/Admin/Repositories/PageRepo.php index 2f0ed732..5675c935 100644 --- a/beike/Admin/Repositories/PageRepo.php +++ b/beike/Admin/Repositories/PageRepo.php @@ -71,10 +71,10 @@ class PageRepo } $page->fill([ 'page_category_id' => (int) ($data['page_category_id'] ?? 0), - 'position' => $data['position'] ?? 0, - 'active' => $data['active'] ?? true, - 'author' => $data['author'] ?? true, - 'views' => $data['views'] ?? 0, + 'position' => (int) ($data['position'] ?? 0), + 'active' => (bool) ($data['active'] ?? true), + 'author' => (bool) ($data['author'] ?? true), + 'views' => (int) ($data['views'] ?? 0), ]); $page->saveOrFail(); diff --git a/beike/Plugin/Plugin.php b/beike/Plugin/Plugin.php index 6f656fbb..d922cd62 100644 --- a/beike/Plugin/Plugin.php +++ b/beike/Plugin/Plugin.php @@ -155,6 +155,7 @@ class Plugin implements Arrayable, \ArrayAccess public function getLocaleName(): string { $currentLocale = locale(); + return is_array($this->name) ? ($this->name[$currentLocale] ?? '') : (string) $this->name; } @@ -166,6 +167,7 @@ class Plugin implements Arrayable, \ArrayAccess public function getLocaleDescription(): string { $currentLocale = locale(); + return is_array($this->description) ? ($this->description[$currentLocale] ?? '') : (string) $this->description; } diff --git a/beike/Shop/Services/TotalServices/CustomerDiscountService.php b/beike/Shop/Services/TotalServices/CustomerDiscountService.php index 4847032d..27d95666 100644 --- a/beike/Shop/Services/TotalServices/CustomerDiscountService.php +++ b/beike/Shop/Services/TotalServices/CustomerDiscountService.php @@ -22,7 +22,7 @@ class CustomerDiscountService public static function getTotal(CheckoutService $checkout) { $totalService = $checkout->totalService; - $customer = current_customer(); + $customer = current_customer(); if (empty($customer)) { return null; }