loginType = $this->request->input('login_type',''); $factory = new LoginTypeFactory(); $service = match ($this->request->input('login_type','')) { 'wx_login' => $factory->wxFastLogin(), 'mobile_code' => $factory->mobileCodeLogin(), default => throw new ErrException('登录类型错误'), }; $loginInfo = $service->handle(); return $this->return->success('登录成功',$loginInfo); } }