model = new Consultant(); $this->validate = true; $this->validateClass = new IndexValidate(); } public function select(Request $request): Response { return ConsultantService::index($request); } /** * Notes: 添加员工 * User: yb * Date: 2024/8/2 * Time: 10:59 * @param Request $request */ public function addConsultant(Request $request) { $params = $request->post(); if (empty($params['name'])) { return json_fail('请输入员工姓名'); } if (empty($params['mobile'])) { return json_fail('请输入员工手机号'); } if (empty($params['dept_id'])) { return json_fail('请选择所属团队'); } return ConsultantService::add($params); } /** * Notes: 更新员工信息 * User: yb * Date: 2024/8/2 * Time: 13:31 * @param Request $request * @return Response */ public function updateConsultant(Request $request) { $params = $request->post(); if (empty($params['name'])) { return json_fail('请输入员工姓名'); } if (empty($params['mobile'])) { return json_fail('请输入员工手机号'); } return ConsultantService::update($params); } /** * Notes: 删除员工 * User: yb * Date: 2024/8/2 * Time: 13:34 * @param Request $request * @return Response */ public function deleteConsultant(Request $request) { $params = $request->post(); if (empty($params['ids'])) { return json_fail('请选择要删除的数据'); } return ConsultantService::delete($params['ids']); } /** * Notes: 绑定后台用户 * User: yb * Date: 2024/8/5 * Time: 10:51 */ public function getUserList() { return ConsultantService::userList(); } }