菜单绑定系统
This commit is contained in:
@@ -23,7 +23,7 @@ class PermService
|
||||
/**
|
||||
* 获取用户所有资源(合并角色+直接分配),结果缓存
|
||||
*/
|
||||
public function getUserResources(int $userId)
|
||||
public function getUserResources(int $userId, string $systemCode)
|
||||
{
|
||||
$cacheKey = self::cacheKey($userId);
|
||||
$cached = Cache::get($cacheKey);
|
||||
@@ -31,7 +31,7 @@ class PermService
|
||||
return $cached;
|
||||
}
|
||||
// 调用 Logic 层获取资源
|
||||
$resources = $this->logic->getUserResources($userId);
|
||||
$resources = $this->logic->getUserResources($userId, $systemCode);
|
||||
// 缓存结果
|
||||
Cache::set($cacheKey, $resources, 3600);
|
||||
return $resources;
|
||||
@@ -40,19 +40,19 @@ class PermService
|
||||
/**
|
||||
* 构建目录/菜单树,节点包含权限与打开方式
|
||||
*/
|
||||
public function getMenuTree(int $userId): array
|
||||
public function getMenuTree(int $userId, string $systemCode): array
|
||||
{
|
||||
// 调用 Logic 层处理菜单构建
|
||||
$resources = $this->getUserResources($userId);
|
||||
$resources = $this->getUserResources($userId, $systemCode);
|
||||
return $this->logic->buildTree($resources);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户所有权限code
|
||||
*/
|
||||
public function getPermissionCodes(int $userId): array
|
||||
public function getPermissionCodes(int $userId, string $systemCode): array
|
||||
{
|
||||
return $this->logic->getPermissionCodes($userId);
|
||||
return $this->logic->getPermissionCodes($userId, $systemCode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user