Merge branch 'dev'

This commit is contained in:
2024-11-02 17:18:17 +08:00
3 changed files with 4 additions and 4 deletions

2
.gitignore vendored
View File

@@ -2,6 +2,8 @@
composer.lock composer.lock
*.log *.log
.user.ini
*.zip *.zip
*.gz *.gz
*副本*.php *副本*.php

View File

@@ -109,7 +109,6 @@ class BaseController extends Controller
->select(); ->select();
$this->cacheTag('ProductCategoryTag')->set('productCategoryList', $this->categoryList); $this->cacheTag('ProductCategoryTag')->set('productCategoryList', $this->categoryList);
} }
$this->categoryList = collection($this->categoryList);
$this->productCategory = $this->buildTreeForCategory($this->categoryList, 0); $this->productCategory = $this->buildTreeForCategory($this->categoryList, 0);
// tiaoshi($this->productCategory[0]['child'][0]['child']);die; // tiaoshi($this->productCategory[0]['child'][0]['child']);die;
@@ -318,7 +317,7 @@ class BaseController extends Controller
// 创建基于主键的数组引用 // 创建基于主键的数组引用
$refer = []; $refer = [];
foreach ($list as $key => $data) { foreach ($list as $key => $data) {
$list[$key] = $data->toArray(); $list[$key] = is_array($data) ? $data : $data->toArray();
$refer[$data[$pk]] = & $list[$key]; $refer[$data[$pk]] = & $list[$key];
} }
foreach ($list as $key => $data) { foreach ($list as $key => $data) {

View File

@@ -118,7 +118,6 @@ class BaseController extends Controller {
->select(); ->select();
$this->cacheTag('ProductCategoryTag')->set('productCategoryList', $this->categoryList); $this->cacheTag('ProductCategoryTag')->set('productCategoryList', $this->categoryList);
} }
$this->categoryList = collection($this->categoryList);
$this->productCategory = $this->buildTreeForCategory($this->categoryList, 0); $this->productCategory = $this->buildTreeForCategory($this->categoryList, 0);
if ($this->cacheHas('country_list')) { if ($this->cacheHas('country_list')) {
@@ -292,7 +291,7 @@ class BaseController extends Controller {
// 创建基于主键的数组引用 // 创建基于主键的数组引用
$refer = []; $refer = [];
foreach ($list as $key => $data) { foreach ($list as $key => $data) {
$list[$key] = $data->toArray(); $list[$key] = is_array($data) ? $data : $data->toArray();
$refer[$data[$pk]] = & $list[$key]; $refer[$data[$pk]] = & $list[$key];
} }
foreach ($list as $key => $data) { foreach ($list as $key => $data) {