更新菜单接口
This commit is contained in:
parent
9e77cf6415
commit
48a14dd3fd
@ -1364,16 +1364,17 @@ class Auth extends BaseController
|
|||||||
public function appMenu()
|
public function appMenu()
|
||||||
{
|
{
|
||||||
$menuList = Db::name('app_menu')->where('is_show', 1)->where('is_disable', 0)->field(['id', 'pid', 'name', 'icon', 'sort', 'paths'])->order('sort', 'asc')->select()->toArray();
|
$menuList = Db::name('app_menu')->where('is_show', 1)->where('is_disable', 0)->field(['id', 'pid', 'name', 'icon', 'sort', 'paths'])->order('sort', 'asc')->select()->toArray();
|
||||||
|
|
||||||
$menuData = [];
|
$menuData = [];
|
||||||
foreach($menuList as $n) {
|
foreach($menuList as $n) {
|
||||||
if ($n['pid'] == 0) {
|
if ($n['pid'] == 0) {
|
||||||
$menuData[$n];
|
$menuData[] = $n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach($menuData as $n) {
|
foreach($menuData as $k=>$v) {
|
||||||
foreach($menuList as $ml) {
|
foreach($menuList as $ml) {
|
||||||
if ($n['id'] == $ml['pid']) {
|
if ($v['id'] == $ml['pid']) {
|
||||||
$menuData['children'][] = $ml;
|
$menuData[$k]['children'][] = $ml;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user