StuckPoint.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 save(Request $request) : \think\Response
  29. {
  30. $params=$request->post();
  31. // var_dump($params);
  32. $params['macs']=implode(',',$params['macs']);
  33. return CatchResponse::success($this->stuckPointModel->storeBy($params));
  34. }
  35. /**
  36. * 读取
  37. * @time 2022年11月01日 16:16
  38. * @param $id
  39. */
  40. public function read($id) : \think\Response
  41. {
  42. return CatchResponse::success($this->stuckPointModel->findBy($id));
  43. }
  44. /**
  45. * 更新
  46. * @time 2022年11月01日 16:16
  47. * @param Request $request
  48. * @param $id
  49. */
  50. public function update(Request $request, $id) : \think\Response
  51. {
  52. return CatchResponse::success($this->stuckPointModel->updateBy($id, $request->post()));
  53. }
  54. /**
  55. * 删除
  56. * @time 2022年11月01日 16:16
  57. * @param $id
  58. */
  59. public function delete($id) : \think\Response
  60. {
  61. return CatchResponse::success($this->stuckPointModel->deleteBy($id,true));
  62. }
  63. }