app = app(); $this->request = request(); // 控制器初始化 $this->initialize(); } /** * 初始化 */ protected function initialize() { //用户信息 $this->user_info = $this->request->user_info ?? []; if(boolval($this->user_info)) { $this->user_id = $this->user_info['id'] ?? null; $this->client = $this->user_info['client'] ?? null; } //分页参数 $page_no = (int)$this->request->get('page_no'); $this->page_no = $page_no && is_numeric($page_no) ? $page_no : $this->page_no; $page_size = (int)$this->request->get('page_size'); $this->page_size = $page_size && is_numeric($page_size) ? $page_size : $this->page_size; $this->page_size = min($this->page_size, 100); } }