request->param('pageSize', 15); $list = $model->getList($this->request->param(), $pageSize); return $this->renderSuccess(compact('list')); } /** * 选项列表 * @return \think\response\Json * @throws \think\db\exception\DbException */ public function options() { $model = new SchoolModel(); $list = $model->getOptionList($this->request->param()); return $this->renderSuccess(compact('list')); } /** * 获取学校主页数据 * @return \think\response\Json * @throws \cores\exception\BaseException * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function homeData() { $schoolId = $this->request->param('school_id', 0); if($schoolId<=0){ $userInfo = UserService::getCurrentLoginUser(true); $schoolId = isset($userInfo['info']['school_id'])? intval($userInfo['info']['school_id']) : 0; $userType = isset($userInfo['user_type'])? $userInfo['user_type'] : 0; $schoolId = $userType != 3? 0 : $schoolId; } if($schoolId <= 0){ return $this->renderSuccess('您无权访问或未绑定学校信息,请先绑定'); } $data = [ 'info'=> SchoolModel::detail($schoolId), 'albums'=> SchoolAlbum::getShowList($schoolId, 6), 'news'=> SchoolNew::getShowList($schoolId, 1, 3), 'scenery'=> SchoolNew::getShowList($schoolId, 2, 6) ]; return $this->renderSuccess($data); } /** * 校园时态 * @return \think\response\Json * @throws \think\db\exception\DbException */ public function dynamic(){ $model = new UserDynamic(); $list = $model->getList($this->request->param()); return $this->renderSuccess(compact('list')); } }