| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <?php
- namespace app\api\controller;
- use app\api\model\User as UserModel;
- use app\api\model\SourceShool as SourceShoolModel;
- use app\api\service\User as UserService;
- /**
- * 学校控制器
- * Class School
- * @package app\api\controller
- */
- class SourceShool extends Controller
- {
- /**
- * 学校列表
- * @return \think\response\Json
- * @throws \think\db\exception\DbException
- */
- public function list()
- {
- // 获取列表数据
- $model = new SourceShoolModel();
- $userInfo = UserService::getCurrentLoginUser(true);
- $userId = isset($userInfo['user_id']) ? intval($userInfo['user_id']) : 0;
- $params = $this->request->param();
- $params['user_id'] = $userId;
- $pageSize = $this->request->param('pageSize', 15);
- $list = $model->getList($params, $pageSize);
- return $this->renderSuccess(compact('list'));
- }
- /**
- * 学校列表
- * @return \think\response\Json
- * @throws \think\db\exception\DbException
- */
- public function lockedList()
- {
- // 获取列表数据
- $model = new SourceShoolModel();
- $userInfo = UserService::getCurrentLoginUser(true);
- $userId = isset($userInfo['user_id']) ? intval($userInfo['user_id']) : 0;
- $params = $this->request->param();
- $params['user_id'] = $userId;
- $params['type'] = 1;
- $pageSize = $this->request->param('pageSize', 15);
- $list = $model->getList($params, $pageSize);
- return $this->renderSuccess(compact('list'));
- }
- /**
- * 选项列表
- * @return \think\response\Json
- * @throws \think\db\exception\DbException
- */
- public function options()
- {
- $model = new SourceShoolModel();
- $list = $model->getOptionList($this->request->param());
- return $this->renderSuccess(compact('list'));
- }
- /**
- * 生源学校学生列表
- * @return \think\response\Json
- * @throws \cores\exception\BaseException
- * @throws \think\db\exception\DbException
- */
- public function student()
- {
- $model = new UserModel;
- $params = $this->request->param();
- $userInfo = UserService::getCurrentLoginUser(true);
- $userId = isset($userInfo['user_id']) ? intval($userInfo['user_id']) : 0;
- $schoolId = isset($params['school_id']) ? intval($params['school_id']) : 0;
- if($schoolId<=0){
- return $this->renderSuccess('学校ID不为空');
- }
- $params['user_id'] = $userId;
- $params['check_type'] = 1;
- $list = $model->getSourceSchoolUserList($params);
- return $this->renderSuccess(compact('list'));
- }
- }
|