code: public function getMenuByPid($menu_pid, $user_id)
      {
          $auth_menu = MemberLogic::instance()->getUserMenu($user_id);
          $map = array(
              'menu_status' => 1,
              'menu_pid' => $menu_pid,
              'id' => [
                  'in',
                  $auth_menu
              ]
          );
          $list = $this->model->where($map)
              ->order('menu_sort asc')
              ->select();
          
          $menu = array();
          foreach ($list as $v) {
              if ($v['menu_group'] && $menu_pid > 0) {
                  $key = 'group_' . md5($v['menu_group']);
                  if (! isset($menu[$key])) {
                      $menu[$key] = [
                          'menu_name' => $v['menu_group'],
                          'sub_menu' => []
                      ];
                  }
                  $menu[$key]['sub_menu'][] = $this->getMenuItem($v);
              } else {
                  $key = 'menu_' . $v['id'];
                  $menu[$key] = $this->getMenuItem($v);
              }
          }
          
          return $menu;
      }
docs: 根据Pid获取菜单
  
  @param number $menu_pid
  @param number $user_id
  @return array