|
@@ -580,25 +580,25 @@ class Authcompany extends \fast\Authpc
|
|
|
|
|
|
// 必须将结果集转换为数组
|
|
|
$ruleList = collection(\app\admin\model\PcAuthRule::where('status', 'normal')
|
|
|
- ->field('id,pid as parentId,name as namerule,title as name,path,component,component_name as componentName,icon')
|
|
|
- ->where('type',2)->where('pid',0)
|
|
|
+ ->field('id,pid as parentId,name as namerule,title as name,path,component,component_name as componentName,icon,visible,alwaysShow,keepAlive')
|
|
|
+ ->where('type',1)->where('pid',0)
|
|
|
->order('weigh', 'desc')
|
|
|
->select())->toArray();
|
|
|
|
|
|
foreach ($ruleList as $k => &$v) {
|
|
|
- $v['alwaysShow'] = true;
|
|
|
- $v['keepAlive'] = true;
|
|
|
- $v['visible'] = true;
|
|
|
+ $v['visible'] = $v['visible'] == 1 ? true : false;
|
|
|
+ $v['alwaysShow'] = $v['alwaysShow'] == 1 ? true : false;
|
|
|
+ $v['keepAlive'] = $v['keepAlive'] == 1 ? true : false;
|
|
|
|
|
|
if (!in_array($v['namerule'], $userRule)) {
|
|
|
unset($ruleList[$k]);
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
- return $ruleList;
|
|
|
+// return $ruleList;
|
|
|
// dump($ruleList);
|
|
|
Tree::instance()->init($ruleList,'parentId');
|
|
|
- $menu = Tree::instance()->getTreeArray(0);
|
|
|
+ $menu = Tree::instance()->getTreeArray_2(0);
|
|
|
// dump($menu);
|
|
|
return $menu;
|
|
|
}
|