model = new \app\admin\model\XhprofRunWatch(); // 命中记录的规则下拉(含禁用规则,便于回溯历史命中) $this->assign('select_list_watch', \app\admin\model\XhprofWatch::column('name', 'id'), true); } /** * @NodeAnotation(title="列表") */ public function index() { if ($this->request->isAjax()) { if (input('selectFields')) { return $this->selectList(); } list($page, $limit, $where, $excludes, $request_options, $group) = $this->buildTableParames(); $count = $this->model ->withJoin(['run', 'watch'], 'LEFT') ->where($where) ->group($group) ->count(); $list = $this->model ->withJoin(['run', 'watch'], 'LEFT') ->where($where) ->page($page, $limit) ->order($this->sort) ->group($group) ->select(); $data = [ 'code' => 0, 'msg' => '', 'count' => $count, 'data' => $list, ]; return json($data); } return $this->fetch(); } /** * @NodeAnotation(title="详情") */ public function read($id) { $row = $this->model->withJoin(['run', 'watch'], 'LEFT')->find($id); empty($row) && $this->error('数据不存在'); // 获取模型的标题(表注释) $title = $row->title; $this->assign('row', $row); $this->assign('title', $title); return $this->fetch(); } }