group(function (): void { // 探活:无鉴权 Route::get('health', HealthController::class)->name('api.v1.health'); // 玩家前缀下:仅 ping 公开;me 与 wallet/* 共用 lottery.player(见下方大组) Route::prefix('player') ->name('api.v1.player.') ->group(function (): void { Route::get('ping', PlayerPingController::class)->name('ping'); }); /* | 已登录玩家:PRD 把路径拆成 `/v1/player/*` 与 `/v1/wallet/*`,这里用同一中间件块避免重复写。 | 勿把 wallet 挂到 player 前缀下,否则会变成 /api/v1/player/wallet/...,与 PRD §10.1.1 不一致。 */ Route::middleware('lottery.player')->group(function (): void { Route::prefix('player') ->name('api.v1.player.') ->group(function (): void { Route::get('me', MeController::class)->name('me'); }); Route::prefix('wallet') ->name('api.v1.wallet.') ->group(function (): void { Route::get('balance', WalletBalanceController::class)->name('balance'); }); }); // 后台 API;lottery.admin 内预留 Sanctum / RBAC Route::middleware('lottery.admin') ->prefix('admin') ->name('api.v1.admin.') ->group(function (): void { Route::get('ping', AdminPingController::class)->name('ping'); }); });