'desc', ]; public function __construct(App $app) { parent::__construct($app); $this->model = new \app\admin\model\XhprofRun(); } /** * @NodeAnotation(title="列表") */ public function index() { if ($this->request->isAjax()) { if (input('selectFields')) { return $this->selectList(); } // wall_time 搜索下限:前端输入毫秒,换算为微秒后再构建查询条件 // 注意:Request::withGet 是整体替换,必须先取全量 GET 再合并写回 $filter = (string) $this->request->get('filter', ''); if ($filter !== '') { $filterArr = json_decode($filter, true) ?: []; if (isset($filterArr['wall_time']) && $filterArr['wall_time'] !== '') { $filterArr['wall_time'] = (string) ((float) $filterArr['wall_time'] * 1000); $this->request->withGet(array_merge($this->request->get(), [ 'filter' => json_encode($filterArr, JSON_UNESCAPED_UNICODE), ])); } } list($page, $limit, $where, $excludes, $request_options, $group) = $this->buildTableParames(); $count = $this->model ->where($where) ->group($group) ->count(); $list = $this->model ->where($where) ->page($page, $limit) ->order($this->sort) ->group($group) ->select(); $data = [ 'code' => 0, 'msg' => '', 'count' => $count, 'data' => $list, ]; return json($data); } // 节点下拉选项(多节点环境区分数据来源) $nodeIds = $this->model->distinct(true)->column('node_id'); $nodeSelect = array_combine($nodeIds, $nodeIds) ?: []; $this->assign('select_list_node_id', $nodeSelect, true); return $this->fetch(); } }