初始化本地仓库

This commit is contained in:
2026-08-31 11:33:59 +08:00
commit 663f74b633
2390 changed files with 402918 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
<?php
declare(strict_types=1);
namespace core\jwt\enum;
/**
* 客户端类型枚举
*/
enum ClientType: string
{
case ADMIN = 'admin';
case API = 'api';
case WEB = 'web';
case MOBILE = 'mobile';
case MINI = 'mini';
/**
* 检查客户端类型是否有效
*/
public static function isValid(string $type): bool
{
foreach (self::cases() as $case) {
if ($case->value === $type) {
return true;
}
}
// 合并配置文件中定义的额外类型
$config = config('jwt.app.client_types', []);
return in_array($type, $config, true);
}
/**
* 获取所有有效的客户端类型值
*
* @return string[]
*/
public static function values(): array
{
$values = array_map(fn(self $case) => $case->value, self::cases());
// 合并配置文件中定义的额外类型
$config = config('jwt.app.client_types', []);
return array_merge($values, $config);
}
/**
* 获取枚举值
*/
public function value(): string
{
return $this->value;
}
}
+33
View File
@@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
namespace core\jwt\enum;
/**
* 登录模式枚举
*/
enum LoginMode: string
{
/**
* 单端登录模式 - 同一用户只能在一个设备登录,新登录会踢掉旧登录
*/
case SINGLE = 'single';
/**
* 客户端模式 - 同一客户端只能在一个设备登录,不同客户端可同时登录
*/
case CLIENT = 'client';
/**
* 多端模式 - 同一用户可在多个设备同时登录
*/
case MULTI = 'multi';
/**
* 获取枚举值
*/
public function value(): string
{
return $this->value;
}
}
+23
View File
@@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
namespace core\jwt\enum;
/**
* Token 状态枚举
*/
enum TokenStatus: string
{
case ACTIVE = 'active';
case REFRESHED = 'refreshed';
case REVOKED = 'revoked';
case EXPIRED = 'expired';
/**
* 获取枚举值
*/
public function value(): string
{
return $this->value;
}
}
+21
View File
@@ -0,0 +1,21 @@
<?php
declare(strict_types=1);
namespace core\jwt\enum;
/**
* Token 类型枚举
*/
enum TokenType: string
{
case ACCESS = 'access';
case REFRESH = 'refresh';
/**
* 获取枚举值
*/
public function value(): string
{
return $this->value;
}
}