Initial commit: ThinkPHP refactor (tp)
Made-with: Cursor
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use think\facade\Route;
|
||||
use app\api\controller\Index;
|
||||
use app\api\controller\User;
|
||||
use app\api\controller\V1Auth;
|
||||
|
||||
/**
|
||||
* API 应用路由
|
||||
*/
|
||||
|
||||
// ==================== v1 版本接口 ====================
|
||||
|
||||
// 健康检查 (公开)
|
||||
Route::get('v1/health', [Index::class, 'health']);
|
||||
|
||||
// 认证接口 (公开)
|
||||
Route::post('v1/auth/login', [V1Auth::class, 'login']);
|
||||
Route::post('v1/auth/register', [V1Auth::class, 'register']);
|
||||
Route::post('v1/auth/refresh', [V1Auth::class, 'refresh']);
|
||||
|
||||
// 认证接口 (需登录)
|
||||
Route::group('v1/auth', function () {
|
||||
Route::get('me', [V1Auth::class, 'me']);
|
||||
Route::post('logout', [V1Auth::class, 'logout']);
|
||||
Route::post('password', [V1Auth::class, 'password']);
|
||||
})->middleware(\app\api\middleware\Auth::class);
|
||||
|
||||
// ==================== 兼容旧版路由 ====================
|
||||
|
||||
Route::get('index', [Index::class, 'index']);
|
||||
Route::get('health', [Index::class, 'health']);
|
||||
Route::post('user/login', [V1Auth::class, 'login']);
|
||||
Route::post('user/register', [V1Auth::class, 'register']);
|
||||
Route::get('user/info', [V1Auth::class, 'me'])->middleware(\app\api\middleware\Auth::class);
|
||||
Reference in New Issue
Block a user