Housekeeper.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?php
  2. namespace app\admin\controller\housekeeper;
  3. use app\admin\controller\BaseController;
  4. use app\admin\server\housekeeper\HousekeeperServer;
  5. class Housekeeper extends BaseController
  6. {
  7. /**
  8. * Notes:管家列表
  9. * @return \support\Response
  10. * User: yym
  11. * Date: 2022/10/28
  12. */
  13. public function getHousekeeperList()
  14. {
  15. $keywords = $this->request->get('keywords', '');//搜索内容 管家账号/姓名/手机号
  16. [$page, $limit] = $this->getPage();
  17. return json_success(HousekeeperServer::getHousekeeperList($keywords, $page, $limit), '获取成功');
  18. }
  19. /**
  20. * Notes:添加管家
  21. * @return \support\Response
  22. * User: yym
  23. * Date: 2022/10/28
  24. */
  25. public function addHousekeeper()
  26. {
  27. $housekeeper_name = $this->request->post('housekeeper_name');//账号
  28. $housekeeper_pwd = $this->request->post('housekeeper_pwd');//密码
  29. $housekeeper_real_name = $this->request->post('housekeeper_real_name');//姓名
  30. $housekeeper_head = $this->request->post('housekeeper_head');//头像
  31. $housekeeper_phone = $this->request->post('housekeeper_phone');//手机号
  32. $housekeeper_position = $this->request->post('housekeeper_position');//职位
  33. $admin_id = $this->request->admin_id;
  34. $this->validateCheck('housekeeper\HousekeeperValidate',
  35. [
  36. 'housekeeper_name' => $housekeeper_name,
  37. 'housekeeper_pwd' => $housekeeper_pwd,
  38. 'housekeeper_real_name' => $housekeeper_real_name,
  39. 'housekeeper_phone' => $housekeeper_phone,
  40. 'housekeeper_position' => $housekeeper_position
  41. ],
  42. 'add'
  43. );
  44. HousekeeperServer::addHousekeeper($admin_id, $housekeeper_name, $housekeeper_pwd, $housekeeper_real_name, $housekeeper_head, $housekeeper_phone, $housekeeper_position);
  45. return json_success([], '添加成功');
  46. }
  47. /**
  48. * Notes:编辑管家
  49. * @return \support\Response
  50. * @throws \Exception
  51. * User: yym
  52. * Date: 2022/10/28
  53. */
  54. public function updateHousekeeper()
  55. {
  56. $housekeeper_id = $this->request->post('housekeeper_id');//编号
  57. $housekeeper_name = $this->request->post('housekeeper_name');//账号
  58. $housekeeper_pwd = $this->request->post('housekeeper_pwd');//密码
  59. $housekeeper_real_name = $this->request->post('housekeeper_real_name');//姓名
  60. $housekeeper_head = $this->request->post('housekeeper_head');//头像
  61. $housekeeper_phone = $this->request->post('housekeeper_phone');//手机号
  62. $housekeeper_position = $this->request->post('housekeeper_position');//职位
  63. $admin_id = $this->request->admin_id;
  64. $this->validateCheck('housekeeper\HousekeeperValidate',
  65. [
  66. 'housekeeper_id' => $housekeeper_id,
  67. 'housekeeper_name' => $housekeeper_name,
  68. 'housekeeper_pwd' => $housekeeper_pwd,
  69. 'housekeeper_real_name' => $housekeeper_real_name,
  70. 'housekeeper_phone' => $housekeeper_phone,
  71. 'housekeeper_position' => $housekeeper_position
  72. ],
  73. 'up'
  74. );
  75. HousekeeperServer::updateHousekeeper($admin_id, $housekeeper_id, $housekeeper_name, $housekeeper_pwd, $housekeeper_real_name, $housekeeper_head, $housekeeper_phone, $housekeeper_position);
  76. return json_success([], '编辑成功');
  77. }
  78. /**
  79. * Notes:获取详情
  80. * @return \support\Response
  81. * User: yym
  82. * Date: 2022/10/28
  83. */
  84. public function getInfo()
  85. {
  86. $housekeeper_id = $this->request->post('housekeeper_id');//编号
  87. $this->validateCheck('housekeeper\HousekeeperValidate', ['housekeeper_id' => $housekeeper_id], 'info');
  88. return json_success(HousekeeperServer::getInfo($housekeeper_id), '获取成功');
  89. }
  90. /**
  91. * Notes:删除管家
  92. * @return \support\Response
  93. * User: yym
  94. * Date: 2022/10/28
  95. */
  96. public function delHousekeeper()
  97. {
  98. $housekeeper_id = $this->request->post('housekeeper_id');//编号
  99. $admin_id = $this->request->admin_id;
  100. $this->validateCheck('housekeeper\HousekeeperValidate', ['housekeeper_id' => $housekeeper_id], 'del');
  101. return json_success(HousekeeperServer::delHousekeeper($admin_id, $housekeeper_id), '获取成功');
  102. }
  103. }