modelClass = new UserGroup; } /** * 会员组列表 */ public function index() { if ($this->request->isAjax()) { //如果发送的来源是Selectpage,则转发到Selectpage if ($this->request->request('keyField')) { return $this->selectpage(); } [$page, $limit, $where, $sort, $order] = $this->buildTableParames(); $count = $this->modelClass ->withCount('user') ->where($where) ->order($sort, $order) ->count(); $data = $this->modelClass ->withCount('user') ->where($where) ->order($sort, $order) ->page($page, $limit) ->select(); $result = ["code" => 0, 'count' => $count, 'data' => $data]; return json($result); } return $this->fetch(); } }