正在显示
1 个修改的文件
包含
3 行增加
和
5 行删除
@@ -40,13 +40,11 @@ class Category extends Api | @@ -40,13 +40,11 @@ class Category extends Api | ||
40 | $tree = Tree::instance(); | 40 | $tree = Tree::instance(); |
41 | $tree->init(collection($list)->toArray(), 'pid'); | 41 | $tree->init(collection($list)->toArray(), 'pid'); |
42 | $list = $this->getTreeList($tree->getTreeArray(0)); | 42 | $list = $this->getTreeList($tree->getTreeArray(0)); |
43 | - // 拼接全部分类,方便前端展示 | 43 | + // 拼接全部一级分类,方便前端展示 |
44 | $all_list = []; | 44 | $all_list = []; |
45 | foreach($list as $v){ | 45 | foreach($list as $v){ |
46 | - if($v['pid'] == 0){ | ||
47 | - $v['childlist'] = []; | ||
48 | - $all_list[] = $v; | ||
49 | - } | 46 | + $v['childlist'] = []; |
47 | + $all_list[] = $v; | ||
50 | } | 48 | } |
51 | $all = [ | 49 | $all = [ |
52 | "id" => 0, | 50 | "id" => 0, |
-
请 注册 或 登录 后发表评论