application/core/manage/logic/MenuLogic.php
public function getSiderMenu($user_id)
    {
        // 当前菜单
        $current_menu = $this->getCurrentMenu();
        
        if (empty($current_menu)) {
            return [];
        } else {
            $sider_menu = $this->getMenuByPid($current_menu['menu_pid'], $user_id);
            foreach ($sider_menu as &$menu) {
                if (isset($menu['sub_menu'])) {
                    $menu['menu_active'] = 0;
                    foreach ($menu['sub_menu'] as &$item) {
                        if ($item['menu_id'] == $current_menu['id']) {
                            $item['menu_active'] = 1;
                            $menu['menu_active'] = 1;
                        } else {
                            $item['menu_active'] = 0;
                        }
                    }
                    unset($item);
                } else {
                    if ($menu['menu_id'] == $current_menu['id']) {
                        $menu['menu_active'] = 1;
                    } else {
                        $menu['menu_active'] = 0;
                    }
                }
            }
            unset($menu);
            return $sider_menu;
        }
    }
public function getSiderMenu($user_id)
    {
        // 当前菜单
        $current_menu = $this->getCurrentMenu();
        
        if (empty($current_menu)) {
            return [];
        } else {
            $sider_menu = $this->getMenuByPid($current_menu['menu_pid'], $user_id);
            foreach ($sider_menu as &$menu) {
                if (isset($menu['sub_menu'])) {
                    $menu['menu_active'] = 0;
                    foreach ($menu['sub_menu'] as &$item) {
                        if ($item['menu_id'] == $current_menu['id']) {
                            $item['menu_active'] = 1;
                            $menu['menu_active'] = 1;
                        } else {
                            $item['menu_active'] = 0;
                        }
                    }
                    unset($item);
                } else {
                    if ($menu['menu_id'] == $current_menu['id']) {
                        $menu['menu_active'] = 1;
                    } else {
                        $menu['menu_active'] = 0;
                    }
                }
            }
            unset($menu);
            return $sider_menu;
        }
    }
public function getSiderMenu ( $ user_id ) { // 当前菜单 $ current_menu = $ this -> getCurrentMenu ( ) ; if ( empty ( $ current_menu ) ) { return [ ] ; } else { $ sider_menu = $ this -> getMenuByPid ( $ current_menu [ 'menu_pid' ] , $ user_id ) ; foreach ( $ sider_menu as & $ menu ) { if ( isset ( $ menu [ 'sub_menu' ] ) ) { $ menu [ 'menu_active' ] = 0 ; foreach ( $ menu [ 'sub_menu' ] as & $ item ) { if ( $ item [ 'menu_id' ] == $ current_menu [ 'id' ] ) { $ item [ 'menu_active' ] = 1 ; $ menu [ 'menu_active' ] = 1 ; } else { $ item [ 'menu_active' ] = 0 ; } } unset ( $ item ) ; } else { if ( $ menu [ 'menu_id' ] == $ current_menu [ 'id' ] ) { $ menu [ 'menu_active' ] = 1 ; } else { $ menu [ 'menu_active' ] = 0 ; } } } unset ( $ menu ) ; return $ sider_menu ; } }
侧边菜单

@param number $user_id
@return array
侧边菜单