API接口-authtoken、redis

This commit is contained in:
2026-03-19 18:07:18 +08:00
parent 019b536a89
commit 4f61c9d7fc
11 changed files with 303 additions and 3 deletions

View File

@@ -39,9 +39,9 @@ return [
],
// 代理服务器IPRequest 类将尝试获取这些代理服务器发送过来的真实IP
'proxy_server_ip' => [],
// Token 配置
// Token 配置(鉴权接口 authtoken 等高频调用建议使用 redis 提升性能)
'token' => [
// 默认驱动方式
// 默认驱动mysql | redisredis 需确保 config/redis.php 已配置且 phpredis 扩展可用)
'default' => 'mysql',
// 加密key
'key' => 'L1iYVS0PChKA9pjcFdmOGb4zfDIHo5xw',
@@ -81,6 +81,17 @@ return [
'cdn_url' => '',
// 内容分发网络URL参数将自动添加 `?`,之后拼接到 cdn_url 的结尾(例如 `imageMogr2/format/heif`
'cdn_url_params' => '',
// 代理鉴权配置(/api/v1/authToken
'agent_auth' => [
// agent_id => secret 映射
'agents' => [
// 'agent_001' => 'your_secret_key',
],
// JWT 签名密钥(留空则使用 token.key
'jwt_secret' => '',
// Token 有效期(秒),默认 24 小时
'token_expire' => 86400,
],
// 版本号
'version' => 'v2.3.6',
// 中心接口地址(用于请求模块市场的数据等用途)

View File

@@ -108,6 +108,9 @@ Route::post('/api/account/retrievePassword', [\app\api\controller\Account::class
// api/ems
Route::post('/api/ems/send', [\app\api\controller\Ems::class, 'send']);
// api/v1 鉴权
Route::add(['GET', 'POST'], '/api/v1/authToken', [\app\api\controller\v1\Auth::class, 'authToken']);
// ==================== Admin 路由 ====================
// Admin 多为 JSON API前端可能用 GET 传参查列表、POST 提交表单,使用 any 确保兼容