Workplan.php 2.0 KB

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