Email.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. /*
  3. * @Descripttion:
  4. * @version: 1版本
  5. * @Author: 李康
  6. * @Date: 2022-06-07 10:16:15
  7. * @LastEditors: 李康
  8. * @LastEditTime: 2022-06-08 17:29:17
  9. */
  10. namespace catchAdmin\email\controller;
  11. use catcher\base\CatchRequest as Request;
  12. use catcher\CatchResponse;
  13. use catcher\base\CatchController;
  14. use catchAdmin\email\model\Email as emailModel;
  15. class Email extends CatchController
  16. {
  17. protected $emailModel;
  18. public function __construct(EmailModel $emailModel)
  19. {
  20. $this->emailModel = $emailModel;
  21. }
  22. /**
  23. * 列表
  24. * @time 2022年06月07日 10:16
  25. * @param Request $request
  26. */
  27. public function index(Request $request) : \think\Response
  28. {
  29. return CatchResponse::paginate($this->emailModel->getList());
  30. }
  31. /**
  32. * 保存信息
  33. * @time 2022年06月07日 10:16
  34. * @param Request $request
  35. */
  36. public function save(Request $request) : \think\Response
  37. {
  38. return CatchResponse::success($this->emailModel->storeBy($request->post()));
  39. }
  40. /**
  41. * 读取
  42. * @time 2022年06月07日 10:16
  43. * @param $id
  44. */
  45. public function read($id) : \think\Response
  46. {
  47. return CatchResponse::success($this->emailModel->findBy($id));
  48. }
  49. /**
  50. * 更新
  51. * @time 2022年06月07日 10:16
  52. * @param Request $request
  53. * @param $id
  54. */
  55. public function update(Request $request, $id) : \think\Response
  56. {
  57. return CatchResponse::success($this->emailModel->updateBy($id, $request->post()));
  58. }
  59. /**
  60. * 删除
  61. * @time 2022年06月07日 10:16
  62. * @param $id
  63. */
  64. public function delete($id) : \think\Response
  65. {
  66. return CatchResponse::success($this->emailModel->deleteBy($id));
  67. }
  68. /**
  69. *
  70. */
  71. public function setEmail()
  72. {
  73. $array = ['17837032683@139.com'];
  74. $this->emailModel->setEmail($array,'警告报警','我还不知道',null);
  75. }
  76. }