From 9fa9af3332a781f9fd9f247e85b4732038c1bcf7 Mon Sep 17 00:00:00 2001 From: jsasg <735273025@qq.com> Date: Sat, 2 Nov 2024 17:16:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DPC=E4=B8=AD=E8=8B=B1?= =?UTF-8?q?=E6=96=87=E4=BA=8C=E7=BA=A7=E5=88=86=E7=B1=BB=E6=97=A0=E5=95=86?= =?UTF-8?q?=E5=93=81=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/index/controller/BaseController.php | 3 +-- app/us/controller/BaseController.php | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/index/controller/BaseController.php b/app/index/controller/BaseController.php index 81d4cdb..27b4bfc 100755 --- a/app/index/controller/BaseController.php +++ b/app/index/controller/BaseController.php @@ -109,7 +109,6 @@ class BaseController extends Controller ->select(); $this->cacheTag('ProductCategoryTag')->set('productCategoryList', $this->categoryList); } - $this->categoryList = collection($this->categoryList); $this->productCategory = $this->buildTreeForCategory($this->categoryList, 0); // tiaoshi($this->productCategory[0]['child'][0]['child']);die; @@ -318,7 +317,7 @@ class BaseController extends Controller // 创建基于主键的数组引用 $refer = []; foreach ($list as $key => $data) { - $list[$key] = $data->toArray(); + $list[$key] = is_array($data) ? $data : $data->toArray(); $refer[$data[$pk]] = & $list[$key]; } foreach ($list as $key => $data) { diff --git a/app/us/controller/BaseController.php b/app/us/controller/BaseController.php index dbdc6f9..84041d9 100755 --- a/app/us/controller/BaseController.php +++ b/app/us/controller/BaseController.php @@ -118,7 +118,6 @@ class BaseController extends Controller { ->select(); $this->cacheTag('ProductCategoryTag')->set('productCategoryList', $this->categoryList); } - $this->categoryList = collection($this->categoryList); $this->productCategory = $this->buildTreeForCategory($this->categoryList, 0); if ($this->cacheHas('country_list')) { @@ -292,7 +291,7 @@ class BaseController extends Controller { // 创建基于主键的数组引用 $refer = []; foreach ($list as $key => $data) { - $list[$key] = $data->toArray(); + $list[$key] = is_array($data) ? $data : $data->toArray(); $refer[$data[$pk]] = & $list[$key]; } foreach ($list as $key => $data) {