From 8120b0c8cc9a026a528fa1068f9bc316abe2f8dd Mon Sep 17 00:00:00 2001 From: weiz <736250432@qq.com> Date: Thu, 25 Jan 2024 14:15:39 +0800 Subject: [PATCH] update --- app/adminapi/lists/material/MaterialClassifyLists.php | 2 +- app/common.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/adminapi/lists/material/MaterialClassifyLists.php b/app/adminapi/lists/material/MaterialClassifyLists.php index 13a463685..a54eec7ab 100644 --- a/app/adminapi/lists/material/MaterialClassifyLists.php +++ b/app/adminapi/lists/material/MaterialClassifyLists.php @@ -60,7 +60,7 @@ class MaterialClassifyLists extends BaseAdminDataLists implements ListsSearchInt ->order(['id' => 'asc']) ->select() ->toArray(); - $data[] = ['id'=>0,'pid'=>0,'name'=>'顶级分类']; + $data[] = ['id'=>0,'pid'=>-1,'name'=>'顶级分类']; return buildTree($data,'pid'); } diff --git a/app/common.php b/app/common.php index bb5867741..411bdbdcd 100755 --- a/app/common.php +++ b/app/common.php @@ -307,7 +307,7 @@ function group_by($array, $key): array return $result; } -function buildTree($items, $parentField, $parentId = 0): array +function buildTree($items, $parentField, $parentId = -1): array { $tree = []; foreach ($items as $item) {