request->param('pageSize', 12); $list = $model->getList($this->request->param(), $pageSize); return $this->renderSuccess(compact('list')); } /** * 文章详情 * @param int $articleId * @return array|\think\response\Json * @throws \app\common\exception\BaseException */ public function detail(int $id) { $detail = SchoolSpecialityModel::getDetail($id); return $this->renderSuccess(compact('detail')); } /** * 同类专业学校 * @return Json * @throws \think\db\exception\DbException */ public function sameList() { // 获取列表数据 $model = new School; $pageSize = $this->request->param('pageSize', 12); $list = $model->getListBySpeciality($this->request->param(), $pageSize); return $this->renderSuccess(compact('list')); } /** * 获取热门专业 * @return Json * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function hots(){ $limit = $this->request->param('limit', 6); $list = (new SchoolSpecialityModel)->getHots(0,'speciality_id,speciality_name,views', (int)$limit); return $this->renderSuccess(compact('list')); } }