diff --git a/app/controller/api/Auth.php b/app/controller/api/Auth.php index bdb01c8f..347f2485 100644 --- a/app/controller/api/Auth.php +++ b/app/controller/api/Auth.php @@ -1364,16 +1364,17 @@ class Auth extends BaseController 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(); + $menuData = []; foreach($menuList as $n) { if ($n['pid'] == 0) { - $menuData[$n]; + $menuData[] = $n; } } - foreach($menuData as $n) { + foreach($menuData as $k=>$v) { foreach($menuList as $ml) { - if ($n['id'] == $ml['pid']) { - $menuData['children'][] = $ml; + if ($v['id'] == $ml['pid']) { + $menuData[$k]['children'][] = $ml; } } }