Fan.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. namespace catchAdmin\wind\controller;
  3. use catcher\base\CatchRequest as Request;
  4. use catcher\CatchResponse;
  5. use catcher\base\CatchController;
  6. use catchAdmin\wind\model\Fan as fanModel;
  7. use think\facade\Db;
  8. class Fan extends CatchController
  9. {
  10. protected $fanModel;
  11. public function __construct(FanModel $fanModel)
  12. {
  13. $this->fanModel = $fanModel;
  14. }
  15. /**
  16. * 列表
  17. * @time 2022年04月28日 19:53
  18. * @param Request $request
  19. */
  20. public function index(Request $request) : \think\Response
  21. {
  22. return CatchResponse::paginate($this->fanModel->getList());
  23. }
  24. /**
  25. * 保存信息
  26. * @time 2022年04月28日 19:53
  27. * @param Request $request
  28. */
  29. public function save(Request $request) : \think\Response
  30. {
  31. $data = $request->post();
  32. return CatchResponse::success($this->fanModel->storeBy($data));
  33. }
  34. /**
  35. * 读取
  36. * @time 2022年04月28日 19:53
  37. * @param $id
  38. */
  39. public function read($id) : \think\Response
  40. {
  41. return CatchResponse::success($this->fanModel->findBy($id));
  42. }
  43. /**
  44. * 更新
  45. * @time 2022年04月28日 19:53
  46. * @param Request $request
  47. * @param $id
  48. */
  49. public function update(Request $request, $id) : \think\Response
  50. { $data = $request->post();
  51. return CatchResponse::success($this->fanModel->updateBy($id, $data));
  52. }
  53. /**
  54. * 删除
  55. * @time 2022年04月28日 19:53
  56. * @param $id
  57. */
  58. public function delete($id) : \think\Response
  59. {
  60. return CatchResponse::success($this->fanModel->deleteBy($id));
  61. }
  62. //获取机位号
  63. // public function getNumber()
  64. // {
  65. // }
  66. }