diff --git a/.gitignore b/.gitignore index 3e3e2af..3224103 100755 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ composer.lock *.log +.user.ini + *.zip *.gz *副本*.php 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) {