public function listAction() { if ($this->request->isAjax()) { $validate = new \Validate(); $id = (int) $validate->getPost('id'); if (!$id) { $this->end(404); } $this->end((new \College())->delCollege($id, $this->session->get('id'))); } //当前页码 $page_id = (int) $this->request->getQuery('page'); $page_id = $page_id < 1 ? 1 : $page_id; //省份code $pro_code = (int) $this->request->getQuery('pro_code'); //城市code $city_code = (int) $this->request->getQuery('city_code'); //性质 $col_type = (int) $this->request->getQuery('col_type'); //关键字 $keyword = preg_replace('/[^\\da-z\\x{4e00}-\\x{9fa5}]/iu', '', mb_substr($this->request->getQuery('keyword'), 0, 10, 'utf-8')); //关键字长度小于10,并且只能是字符数字中文 //每页显示条数 $limit = 20; //省市区县 $site = new \Site(); $provinces = $site->getProvince(); //省 $cities = $site->getCity($pro_code); //城市 //查询数据 $college = new \College(); $result = $college->getList($page_id, $limit, $pro_code, $city_code, $col_type, $keyword); //数据 $page_html = $this->pageHtml($result['page']); //分页html //加载js $this->assets->addJs('backend/mt-js/college-list.js'); $this->view->setVars(['pro_code' => $pro_code, 'city_code' => $city_code, 'col_type' => $col_type, 'keyword' => $keyword, 'provinces' => $provinces, 'cities' => $cities, 'list' => $result['list'], 'page_html' => $page_html]); }