InstitutionController.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2017~2021 LARAVEL研发中心
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: http://www.laravel.cn
  8. // +----------------------------------------------------------------------
  9. // | Author: laravel开发员 <laravel.qq.com>
  10. // +----------------------------------------------------------------------
  11. namespace App\Http\Controllers\Admin;
  12. use App\Services\Common\InstitutionService;
  13. /**
  14. * 院校管理-控制器
  15. * @author laravel开发员
  16. * @since 2024/01/08
  17. * Class InstitutionController
  18. * @package App\Http\Controllers\Admin
  19. */
  20. class InstitutionController extends Backend
  21. {
  22. /**
  23. * 构造函数
  24. * @author laravel开发员
  25. * @since 2024/01/08
  26. * InstitutionController constructor.
  27. */
  28. public function __construct()
  29. {
  30. parent::__construct();
  31. $this->service = new InstitutionService();
  32. }
  33. /**
  34. * 列表
  35. * @return array
  36. */
  37. public function index()
  38. {
  39. $pageSize = request()->get('limit', 10);
  40. $list = $this->service->getDataList(request()->all(), $pageSize);
  41. $message = array(
  42. "msg" => '操作成功',
  43. "code" => 0,
  44. "data" => isset($list['list']) ? $list['list'] : [],
  45. "count" => isset($list['total']) ? $list['total'] : 0,
  46. );
  47. return $message;
  48. }
  49. /**
  50. * 详情
  51. * @return array
  52. */
  53. public function info()
  54. {
  55. $id = request()->input("id", 0);
  56. $info = [];
  57. if ($id) {
  58. $info = $this->service->info();
  59. }
  60. return message(MESSAGE_OK, true, $info);
  61. }
  62. /**
  63. * 添加或编辑
  64. * @return array
  65. */
  66. public function edit()
  67. {
  68. return $this->service->edit();
  69. }
  70. /**
  71. * 删除
  72. * @return array
  73. */
  74. public function delete()
  75. {
  76. return $this->service->delete();
  77. }
  78. /**
  79. * 修改状态
  80. * @return array
  81. */
  82. public function status()
  83. {
  84. return $this->service->status();
  85. }
  86. /**
  87. * 选项列表
  88. * @return mixed
  89. */
  90. public function options()
  91. {
  92. $result = $this->service->options();
  93. return message(1002, true, $result);
  94. }
  95. /**
  96. * 设置排序
  97. * @return mixed
  98. */
  99. public function sort()
  100. {
  101. $result = $this->service->sort();
  102. return $result;
  103. }
  104. }