update
This commit is contained in:
parent
8120b0c8cc
commit
65b112c5c9
@ -60,7 +60,6 @@ class MaterialClassifyLists extends BaseAdminDataLists implements ListsSearchInt
|
|||||||
->order(['id' => 'asc'])
|
->order(['id' => 'asc'])
|
||||||
->select()
|
->select()
|
||||||
->toArray();
|
->toArray();
|
||||||
$data[] = ['id'=>0,'pid'=>-1,'name'=>'顶级分类'];
|
|
||||||
return buildTree($data,'pid');
|
return buildTree($data,'pid');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,7 +307,7 @@ function group_by($array, $key): array
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildTree($items, $parentField, $parentId = -1): array
|
function buildTree($items, $parentField, $parentId = 0): array
|
||||||
{
|
{
|
||||||
$tree = [];
|
$tree = [];
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user