SensitiveWord.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace catchAdmin\system\controller;
  3. use catchAdmin\system\request\sensitiveWord\CreateRequest;
  4. use catchAdmin\system\request\sensitiveWord\UpdateRequest;
  5. use catcher\base\CatchController;
  6. use catchAdmin\system\model\SensitiveWord as Model;
  7. use catcher\base\CatchRequest;
  8. use catcher\CatchResponse;
  9. class SensitiveWord extends CatchController
  10. {
  11. protected $sensitiveWord;
  12. public function __construct(Model $model)
  13. {
  14. $this->sensitiveWord = $model;
  15. }
  16. /**
  17. * 列表
  18. *
  19. * @time 2020年06月17日
  20. * @return \think\response\Json
  21. */
  22. public function index()
  23. {
  24. return CatchResponse::paginate($this->sensitiveWord->getList());
  25. }
  26. /**
  27. * 保存
  28. *
  29. * @time 2020年06月17日
  30. * @param CreateRequest $request
  31. * @return \think\response\Json
  32. */
  33. public function save(CreateRequest $request)
  34. {
  35. return CatchResponse::success($this->sensitiveWord->storeBy($request->param()));
  36. }
  37. /**
  38. * 更新
  39. *
  40. * @time 2020年06月17日
  41. * @param $id
  42. * @param UpdateRequest $request
  43. * @return \think\response\Json
  44. */
  45. public function update($id, UpdateRequest $request)
  46. {
  47. return CatchResponse::success($this->sensitiveWord->updateBy($id, $request->param()));
  48. }
  49. /**
  50. * 删除
  51. *
  52. * @time 2020年06月17日
  53. * @param $id
  54. * @return \think\response\Json
  55. */
  56. public function delete($id)
  57. {
  58. return CatchResponse::success($this->sensitiveWord->deleteBy($id));
  59. }
  60. }