BookScheduling.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <?php
  2. namespace app\admin\controller\life;
  3. use app\admin\controller\BaseController;
  4. use app\admin\server\life\BookSchedulingServer;
  5. class BookScheduling extends BaseController
  6. {
  7. /**
  8. * Notes:获取万悦书院课程排期列表
  9. * @return \support\Response
  10. * User: ZQ
  11. * Date: 2022/10/25
  12. */
  13. public function getBookSchedulingList()
  14. {
  15. [$page, $limit] = $this->getPage();
  16. $keywords = $this->request->get('keywords');
  17. $result = BookSchedulingServer::getBookSchedulingList($page, $limit, $keywords);
  18. return json_success($result, '成功');
  19. }
  20. /**
  21. * Notes:获取所有课程排期
  22. * @return \support\Response
  23. * User: ZQ
  24. * Date: 2022/10/25
  25. */
  26. public function getBookSchedulingAll()
  27. {
  28. $result = BookSchedulingServer::getBookSchedulingAll();
  29. return json_success($result, '成功');
  30. }
  31. /**
  32. * Notes:修改万悦书院排期
  33. * @return \support\Response
  34. * User: ZQ
  35. * Date: 2022/10/25
  36. */
  37. public function updateBookScheduling()
  38. {
  39. $scheduling_id = $this->request->post('scheduling_id');
  40. $scheduling_book_id = $this->request->post('scheduling_book_id');
  41. $scheduling_start_time = $this->request->post('scheduling_start_time');
  42. $scheduling_end_time = $this->request->post('scheduling_end_time');
  43. $admin_id = $this->request->admin_id;
  44. $this->validateCheck('life\BookSchedulingValidate', ['scheduling_id'=>$scheduling_id,'scheduling_book_id'=>$scheduling_book_id,'scheduling_start_time'=>$scheduling_start_time,'scheduling_book_id'=>$scheduling_book_id,'scheduling_end_time'=>$scheduling_end_time], 'update');
  45. $result = BookSchedulingServer::updateBookScheduling($scheduling_id, $scheduling_book_id, $scheduling_start_time, $scheduling_end_time, $admin_id);
  46. return json_success($result, '修改成功');
  47. }
  48. /**
  49. * Notes:删除课程排期
  50. * @return \support\Response
  51. * User: ZQ
  52. * Date: 2022/10/25
  53. */
  54. public function delBookScheduling()
  55. {
  56. $scheduling_id = $this->request->get('scheduling_id');
  57. $admin_id = $this->request->admin_id;
  58. $this->validateCheck('life\BookSchedulingValidate', ['scheduling_id' => $scheduling_id], 'info');
  59. $result = BookSchedulingServer::delBookScheduling($scheduling_id,$admin_id);
  60. if ($result){
  61. return json_success($result, '删除成功');
  62. }else{
  63. throw new \Exception('删除失败!');
  64. }
  65. }
  66. /**
  67. * Notes:添加课程排期
  68. * @return \support\Response
  69. * User: ZQ
  70. * Date: 2022/10/25
  71. */
  72. public function addBookScheduling()
  73. {
  74. $scheduling_book_id = $this->request->post('scheduling_book_id');
  75. $scheduling_start_time = $this->request->post('scheduling_start_time');
  76. $scheduling_end_time = $this->request->post('scheduling_end_time');
  77. $admin_id = $this->request->admin_id;
  78. $this->validateCheck('life\BookSchedulingValidate', ['scheduling_book_id'=>$scheduling_book_id,'scheduling_start_time'=>$scheduling_start_time,'scheduling_book_id'=>$scheduling_book_id,'scheduling_end_time'=>$scheduling_end_time], 'create');
  79. $result = BookSchedulingServer::insertBookScheduling($scheduling_book_id, $scheduling_start_time, $scheduling_end_time, $admin_id);
  80. return json_success($result, '添加成功');
  81. }
  82. /**
  83. * Notes:查询课程排期详情
  84. * @return \support\Response
  85. * User: ZQ
  86. * Date: 2022/10/25
  87. */
  88. public function schedulingInfo()
  89. {
  90. $scheduling_id = $this->request->get('scheduling_id');
  91. $this->validateCheck('life\BookSchedulingValidate', ['scheduling_id' => $scheduling_id], 'info');
  92. $result = BookSchedulingServer::schedulingInfo($scheduling_id);
  93. return json_success($result, '成功');
  94. }
  95. }