validated(); $vo = new UserServiceVo(); $vo->setUsername($requestData['username']); $vo->setPassword($requestData['password']); return $this->success(['token' => $this->userService->login($vo)]); } /** * @return ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface * @throws \Psr\SimpleCache\InvalidArgumentException */ #[PostMapping("logout"), Auth] public function logout(): ResponseInterface { $this->userService->logout(); return $this->success(); } /** * 用户信息 * /** * @param SystemUserRequest $request * @return ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[GetMapping("getInfo"), Auth] public function getInfo(): ResponseInterface { return $this->success($this->systemUserService->getInfo()); } /** * 刷新token * @param LoginUser $user * @return ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface * @throws \Psr\SimpleCache\InvalidArgumentException */ #[PostMapping("refresh")] public function refresh(LoginUser $user): ResponseInterface { return $this->success(['token' => $user->refresh()]); } }