// 递归:菜单分类显示
public function levelList($table ='mvc_category', $id = 0,$data_list = [],$level=0){
// 查询出来所有的一级
$data = Db::table($table)->where([
'fid'=>$id
])->select();
// 组装数据
foreach($data as $k => $v){
$data_list[$v['id']]['name'] = str_repeat(' ',$level).'|-'.$v['name'];
$data_list[$v['id']]['id'] = $v['id'];
$data_list[$v['id']]['fid'] = $v['fid'];
if(isset($v['type'])){
$data_list[$v['id']]['type'] = $v['type'];
}
if(isset($v['module'])){
$data_list[$v['id']]['module'] = $v['module'];
}
$data_list[$v['id']]['level'] = $level;
$data_list = $this->levelList($table,$v['id'],$data_list,$level+1);
}
return $data_list;
}