code: public function getMainMenu($user_id)
      {
          // 当前菜单
          $current_menu = $this->getCurrentMenu();
          
          $main_menu = $this->getMenuByPid(0, $user_id);
          foreach ($main_menu as &$menu) {
              
              // 菜单权限
              if (empty($menu['menu_url_origin'])) {
                  $menu_url = $this->getMainMenuUrl($menu['menu_id'], $user_id);
                  is_null($menu_url) || $menu['menu_url'] = $menu_url;
              }
              
              if ($current_menu && $menu['menu_id'] == $current_menu['menu_pid']) {
                  $menu['menu_active'] = 1;
              } else {
                  $menu['menu_active'] = 0;
              }
          }
          unset($menu);
          
          return $main_menu;
      }
docs: 主菜单
  
  @param number $user_id
  @return array