StuckPoint.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. namespace catchAdmin\transport\controller;
  3. use catcher\base\CatchRequest as Request;
  4. use catcher\CatchResponse;
  5. use catcher\base\CatchController;
  6. use catchAdmin\transport\model\StuckPoint as stuckPointModel;
  7. class StuckPoint extends CatchController
  8. {
  9. protected $stuckPointModel;
  10. public function __construct(StuckPointModel $stuckPointModel)
  11. {
  12. $this->stuckPointModel = $stuckPointModel;
  13. }
  14. /**
  15. * 列表
  16. * @time 2022年11月01日 16:16
  17. * @param Request $request
  18. */
  19. public function index(Request $request) : \think\Response
  20. {
  21. return CatchResponse::paginate($this->stuckPointModel->getList());
  22. }
  23. /**
  24. * 列表
  25. * @time 2022年11月01日 16:16
  26. * @param Request $request
  27. */
  28. public function getAllList(Request $request) : \think\Response
  29. {
  30. return CatchResponse::success($this->stuckPointModel->getAllList());
  31. }
  32. /**
  33. * 保存信息
  34. * @time 2022年11月01日 16:16
  35. * @param Request $request
  36. */
  37. public function save(Request $request) : \think\Response
  38. {
  39. $params=$request->post();
  40. // var_dump($params);
  41. $params['macs']=implode(',',$params['macs']);
  42. return CatchResponse::success($this->stuckPointModel->storeBy($params));
  43. }
  44. /**
  45. * 读取
  46. * @time 2022年11月01日 16:16
  47. * @param $id
  48. */
  49. public function read($id) : \think\Response
  50. {
  51. return CatchResponse::success($this->stuckPointModel->findBy($id));
  52. }
  53. /**
  54. * 更新
  55. * @time 2022年11月01日 16:16
  56. * @param Request $request
  57. * @param $id
  58. */
  59. public function update(Request $request, $id) : \think\Response
  60. {
  61. $params=$request->post();
  62. $params['macs']=implode(',',$params['macs']);
  63. return CatchResponse::success($this->stuckPointModel->updateBy($id, $params));
  64. }
  65. /**
  66. * 删除
  67. * @time 2022年11月01日 16:16
  68. * @param $id
  69. */
  70. public function delete($id) : \think\Response
  71. {
  72. return CatchResponse::success($this->stuckPointModel->deleteBy($id,true));
  73. }
  74. }