mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-08-30 12:45:32 +08:00
feat: 升级权限管理模式
This commit is contained in:
@@ -22,4 +22,56 @@ class NodeServiceBase
|
||||
|
||||
return $nodeList;
|
||||
}
|
||||
public function getNodeParis()
|
||||
{
|
||||
$node_list = $this->getNodelist();
|
||||
return array_column($node_list, null, 'node');
|
||||
}
|
||||
|
||||
public function getNodeCollection()
|
||||
{
|
||||
$nodeList = $this->getNodelist();
|
||||
|
||||
$nodeCollection = collect($nodeList);
|
||||
|
||||
return $nodeCollection;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取节点服务
|
||||
* @return array
|
||||
* @throws \Doctrine\Common\Annotations\AnnotationException
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public function getNodeTree()
|
||||
{
|
||||
$nodelList = $this->getNodelist();
|
||||
|
||||
$newNodeList = [];
|
||||
foreach ($nodelList as $vo) {
|
||||
if ($vo['type'] == 1) {
|
||||
if (!isset($newNodeList[$vo['module']])) {
|
||||
$newNodeList[$vo['module']] = [
|
||||
'title' => $vo['module'],
|
||||
'children' => [],
|
||||
];
|
||||
}
|
||||
|
||||
$vo['title'] = "{$vo['title']}";
|
||||
$children = [];
|
||||
foreach ($nodelList as $v) {
|
||||
if ($v['type'] == 2 && strpos($v['node'], $vo['node'] . '/') !== false) {
|
||||
$v['title'] = "{$v['title']}";
|
||||
$children[] = $v;
|
||||
}
|
||||
}
|
||||
!empty($children) && $vo['children'] = $children;
|
||||
$newNodeList[$vo['module']]['children'][] = $vo;
|
||||
}
|
||||
}
|
||||
$newNodeList = array_values($newNodeList);
|
||||
array_unshift($newNodeList, ['title' => '全部', 'children' => []]);
|
||||
|
||||
return $newNodeList;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user