Files
hyperf_service/app/Service/Api/Login/LogOutService.php
2025-03-20 15:27:53 +08:00

38 lines
768 B
PHP

<?php
/**
* This service file is part of item.
*
* @author ctexthuang
* @contact ctexthuang@qq.com
*/
declare(strict_types=1);
namespace App\Service\Api\Login;
use App\Cache\Redis\Api\UserCache;
use App\Service\Api\BaseService;
use Hyperf\Di\Annotation\Inject;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
class LogOutService extends BaseService
{
/**
* @var UserCache
*/
#[Inject]
protected UserCache $userCache;
/**
* @return array
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function handle(): array
{
$this->userCache->removeUserToken($this->userId);
return $this->return->success();
}
}