Notice.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. namespace app\admin\controller\notice;
  3. use app\admin\controller\BaseController;
  4. use app\admin\server\notice\NoticetServer;
  5. class Notice extends BaseController
  6. {
  7. /**
  8. * Notes:获取预约科目列表
  9. * @return \support\Response
  10. * User: ZQ
  11. * Date: 2022/9/29
  12. */
  13. public function getNoticeList()
  14. {
  15. $keywords = $this->request->get('keywords');
  16. $result = NoticeServer::getNoticeList($keywords);
  17. return json_success($result, '成功');
  18. }
  19. /**
  20. * Notes:修改预约科目
  21. * @return \support\Response
  22. * User: ZQ
  23. * Date: 2022/9/29
  24. */
  25. public function updateNotice()
  26. {
  27. $notice_id = $this->request->post('notice_id');
  28. $notice_title = $this->request->post('notice_title','');
  29. $notice_introduce = $this->request->post('notice_introduce','');
  30. $notic_content = $this->request->post('notic_content','');
  31. $this->validateCheck('notice\NoticeValidate', ['notice_id'=>$notice_id], 'update');
  32. $result = NoticeServer::updateNotice($notice_id, $notice_title, $notice_introduce, $notic_content);
  33. return json_success($result, '修改成功');
  34. }
  35. /**
  36. * Notes:删除预约科目
  37. * @return \support\Response
  38. * User: ZQ
  39. * Date: 2022/9/27
  40. */
  41. public function delNotice()
  42. {
  43. $notice_id = $this->request->get('notice_id');
  44. $this->validateCheck('notice\NoticeValidate', ['notice_id' => $notice_id], 'info');
  45. $result = NoticeServer::delNotice($notice_id);
  46. if ($result){
  47. return json_success($result, '删除成功');
  48. }else{
  49. throw new \Exception('删除失败!');
  50. }
  51. }
  52. /**
  53. * Notes:添加预约科目
  54. * @return \support\Response
  55. * User: ZQ
  56. * Date: 2022/9/27
  57. */
  58. public function addNotice()
  59. {
  60. $notice_title = $this->request->post('notice_title','');
  61. $notice_introduce = $this->request->post('notice_introduce','');
  62. $notic_content = $this->request->post('notic_content','');
  63. $this->validateCheck('notice\NoticeValidate', ['notice_title' => $notice_title, 'notice_introduce' => $notice_introduce, 'notic_content' => $notic_content], 'create');
  64. $result = NoticeServer::insertNotice($notice_title, $notice_introduce, $notic_content);
  65. return json_success($result, '添加成功');
  66. }
  67. /**
  68. * Notes:查询预约科目详情
  69. * @return \support\Response
  70. * User: ZQ
  71. * Date: 2022/9/27
  72. */
  73. public function noticeInfo()
  74. {
  75. $notice_id = $this->request->get('notice_id');
  76. $this->validateCheck('notice\NoticeValidate', ['notice_id' => $notice_id], 'info');
  77. $result = NoticeServer::noticeInfo($notice_id);
  78. if (!empty($result))
  79. return json_success($result, '成功');
  80. }
  81. }