项目初始化

This commit is contained in:
2026-03-18 15:54:43 +08:00
commit dfcd762e23
601 changed files with 57883 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
<?php
declare(strict_types=1);
namespace app\common\facade;
use app\common\library\Token as TokenLibrary;
/**
* Token 门面类Webman 等价实现,替代 ThinkPHP Facade
* @see TokenLibrary
* @method static array get(string $token)
* @method static bool set(string $token, string $type, int $userId, ?int $expire = null)
* @method static bool check(string $token, string $type, int $userId)
* @method static bool delete(string $token)
* @method static bool clear(string $type, int $userId)
* @method static void tokenExpirationCheck(array $token)
*/
class Token
{
private static ?TokenLibrary $instance = null;
private static function getInstance(): TokenLibrary
{
if (self::$instance === null) {
self::$instance = new TokenLibrary();
}
return self::$instance;
}
public static function get(string $token): array
{
return self::getInstance()->get($token);
}
public static function set(string $token, string $type, int $userId, ?int $expire = null): bool
{
return self::getInstance()->set($token, $type, $userId, $expire);
}
public static function check(string $token, string $type, int $userId): bool
{
return self::getInstance()->check($token, $type, $userId);
}
public static function delete(string $token): bool
{
return self::getInstance()->delete($token);
}
public static function clear(string $type, int $userId): bool
{
return self::getInstance()->clear($type, $userId);
}
public static function tokenExpirationCheck(array $token): void
{
self::getInstance()->tokenExpirationCheck($token);
}
}