SchoolSpeciality.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace app\api\controller;
  3. use app\api\model\School;
  4. use app\api\model\SchoolSpeciality as SchoolSpecialityModel;
  5. use think\response\Json;
  6. /**
  7. * 学校专业控制器
  8. * Class SchoolSpeciality
  9. * @package app\api\controller
  10. */
  11. class SchoolSpeciality extends Controller
  12. {
  13. /**
  14. * 学校列表
  15. * @return \think\response\Json
  16. * @throws \think\db\exception\DbException
  17. */
  18. public function list()
  19. {
  20. // 获取列表数据
  21. $model = new SchoolSpecialityModel;
  22. $pageSize = $this->request->param('pageSize', 12);
  23. $list = $model->getList($this->request->param(), $pageSize);
  24. return $this->renderSuccess(compact('list'));
  25. }
  26. /**
  27. * 文章详情
  28. * @param int $articleId
  29. * @return array|\think\response\Json
  30. * @throws \app\common\exception\BaseException
  31. */
  32. public function detail(int $id)
  33. {
  34. $detail = SchoolSpecialityModel::getDetail($id);
  35. return $this->renderSuccess(compact('detail'));
  36. }
  37. public function sameList()
  38. {
  39. // 获取列表数据
  40. $model = new School;
  41. $pageSize = $this->request->param('pageSize', 12);
  42. $list = $model->getList($this->request->param(), $pageSize);
  43. return $this->renderSuccess(compact('list'));
  44. }
  45. }