app = app(); $this->request = request(); // 控制器初始化 $this->initialize(); } /** * 初始化 */ protected function initialize() { //客服信息 if (isset($this->request->kefu_info) && $this->request->kefu_info) { $this->kefu_info = $this->request->kefu_info ?? []; } if(boolval($this->kefu_info)) { $this->shop_id = $this->kefu_info['shop_id'] ?? 0; $this->kefu_id = $this->kefu_info['id'] ?? null; $this->kefu_name = $this->kefu_info['nickname'] ?? null; $this->client = $this->kefu_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); } }