service = UserService::getInstance(); $this->insertField = [ 'account', 'nick_name', 'password', 'role_id' ]; $this->updateField = [ 'id', 'account', 'nick_name', 'role_id' ]; $this->notRequest = ['qr_code', 'avatar', 'email', 'status']; } /** * 修改密码 * @Method POST * @return JsonResponse * @throws Exception */ public function changePassword(): JsonResponse { $this->insertField = ['password', 'new_password']; $params = $this->checkRequiredFields(request()->post()); return jok( $this->service->changePassword($params['password'], $params['new_password']), '重置密码成功' ); } /** * 重置密码 * @Method POST * @return JsonResponse * @throws Exception */ public function resetPassword(): JsonResponse { $this->insertField = ['id', 'password', 'new_password']; $params = $this->checkRequiredFields(request()->post()); return jok( $this->service->resetPassword($params['id'], $params['password'], $params['new_password']), '重置密码成功' ); } }