123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- <?php
- namespace app\admin\controller\housekeeper;
- use app\admin\controller\BaseController;
- use app\admin\server\housekeeper\HousekeeperServer;
- class Housekeeper extends BaseController
- {
- /**
- * Notes:管家列表
- * @return \support\Response
- * User: yym
- * Date: 2022/10/28
- */
- public function getHousekeeperList()
- {
- $keywords = $this->request->get('keywords', '');//搜索内容 管家账号/姓名/手机号
- [$page, $limit] = $this->getPage();
- return json_success(HousekeeperServer::getHousekeeperList($keywords, $page, $limit), '获取成功');
- }
- /**
- * Notes:添加管家
- * @return \support\Response
- * User: yym
- * Date: 2022/10/28
- */
- public function addHousekeeper()
- {
- $housekeeper_name = $this->request->post('housekeeper_name');//账号
- $housekeeper_pwd = $this->request->post('housekeeper_pwd');//密码
- $housekeeper_real_name = $this->request->post('housekeeper_real_name');//姓名
- $housekeeper_head = $this->request->post('housekeeper_head');//头像
- $housekeeper_phone = $this->request->post('housekeeper_phone');//手机号
- $housekeeper_position = $this->request->post('housekeeper_position');//职位
- $admin_id = $this->request->admin_id;
- $this->validateCheck('housekeeper\HousekeeperValidate',
- [
- 'housekeeper_name' => $housekeeper_name,
- 'housekeeper_pwd' => $housekeeper_pwd,
- 'housekeeper_real_name' => $housekeeper_real_name,
- 'housekeeper_phone' => $housekeeper_phone,
- 'housekeeper_position' => $housekeeper_position
- ],
- 'add'
- );
- HousekeeperServer::addHousekeeper($admin_id, $housekeeper_name, $housekeeper_pwd, $housekeeper_real_name, $housekeeper_head, $housekeeper_phone, $housekeeper_position);
- return json_success([], '添加成功');
- }
- /**
- * Notes:编辑管家
- * @return \support\Response
- * @throws \Exception
- * User: yym
- * Date: 2022/10/28
- */
- public function updateHousekeeper()
- {
- $housekeeper_id = $this->request->post('housekeeper_id');//编号
- $housekeeper_name = $this->request->post('housekeeper_name');//账号
- $housekeeper_pwd = $this->request->post('housekeeper_pwd');//密码
- $housekeeper_real_name = $this->request->post('housekeeper_real_name');//姓名
- $housekeeper_head = $this->request->post('housekeeper_head');//头像
- $housekeeper_phone = $this->request->post('housekeeper_phone');//手机号
- $housekeeper_position = $this->request->post('housekeeper_position');//职位
- $admin_id = $this->request->admin_id;
- $this->validateCheck('housekeeper\HousekeeperValidate',
- [
- 'housekeeper_id' => $housekeeper_id,
- 'housekeeper_name' => $housekeeper_name,
- 'housekeeper_pwd' => $housekeeper_pwd,
- 'housekeeper_real_name' => $housekeeper_real_name,
- 'housekeeper_phone' => $housekeeper_phone,
- 'housekeeper_position' => $housekeeper_position
- ],
- 'up'
- );
- HousekeeperServer::updateHousekeeper($admin_id, $housekeeper_id, $housekeeper_name, $housekeeper_pwd, $housekeeper_real_name, $housekeeper_head, $housekeeper_phone, $housekeeper_position);
- return json_success([], '编辑成功');
- }
- /**
- * Notes:获取详情
- * @return \support\Response
- * User: yym
- * Date: 2022/10/28
- */
- public function getInfo()
- {
- $housekeeper_id = $this->request->post('housekeeper_id');//编号
- $this->validateCheck('housekeeper\HousekeeperValidate', ['housekeeper_id' => $housekeeper_id], 'info');
- return json_success(HousekeeperServer::getInfo($housekeeper_id), '获取成功');
- }
- /**
- * Notes:删除管家
- * @return \support\Response
- * User: yym
- * Date: 2022/10/28
- */
- public function delHousekeeper()
- {
- $housekeeper_id = $this->request->post('housekeeper_id');//编号
- $admin_id = $this->request->admin_id;
- $this->validateCheck('housekeeper\HousekeeperValidate', ['housekeeper_id' => $housekeeper_id], 'del');
- return json_success(HousekeeperServer::delHousekeeper($admin_id, $housekeeper_id), '获取成功');
- }
- }
|