feat: 升级权限管理模式

This commit is contained in:
augushong
2025-03-20 16:57:05 +08:00
parent 1887733b32
commit d3e85fa552
50 changed files with 330 additions and 1125 deletions

View File

@@ -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;
}
}