[接口]鉴权authToken用户登录login-注册register-退出logout, 并将用户信息保存到redis中

This commit is contained in:
2026-03-04 11:39:11 +08:00
parent ad56d6d4ce
commit 77a898df22
10 changed files with 585 additions and 7 deletions

View File

@@ -13,9 +13,15 @@
*/
use Webman\Route;
use app\api\middleware\CheckApiAuthMiddleware;
// API 路由:需先调用 /api/authToken 获取 auth-token请求时携带 header: auth-token 或 Authorization: Bearer <token>
Route::group('/api', function () {
Route::any('/authToken', [app\api\controller\AuthTokenController::class, 'index']);
Route::post('/user/login', [app\api\controller\UserController::class, 'login']);
Route::post('/user/register', [app\api\controller\UserController::class, 'register']);
Route::post('/user/logout', [app\api\controller\UserController::class, 'logout']);
})->middleware([CheckApiAuthMiddleware::class]);