feat(MenuLogic): 修改菜单逻辑以支持非管理员角色

This commit is contained in:
mkm 2024-06-09 13:05:49 +08:00
parent e6405cd648
commit 130129091b

View File

@ -51,15 +51,13 @@ class MenuLogic extends BaseLogic
$where[] = ['type', 'in', ['M', 'C']];
$where[] = ['is_disable', '=', 0];
if ($admin['is_admin'] != 1 || $admin['is_manager'] != 1) {
if ($admin['is_admin'] == 0 && $admin['is_manager'] == 1||$admin['is_admin'] == 0 && $admin['is_manager'] == 0) {
$roleMenu = SystemRoleMenu::whereIn('role_id', $admin['role_id'])->column('menu_id');
$where[] = ['id', 'in', $roleMenu];
}
$menu = SystemStoreMenu::where($where)
->order(['sort' => 'desc', 'id' => 'asc'])
->select()->toArray();
return linear_to_tree($menu, 'children');
}