2025-03-16 17:43:30 +08:00
|
|
|
<?php
|
|
|
|
|
// common模块路由配置
|
|
|
|
|
|
|
|
|
|
use think\facade\Route;
|
|
|
|
|
|
|
|
|
|
// 添加测试路由
|
|
|
|
|
Route::get('api/test', function() {
|
|
|
|
|
return json([
|
|
|
|
|
'code' => 200,
|
|
|
|
|
'msg' => '路由测试成功',
|
|
|
|
|
'data' => [
|
|
|
|
|
'time' => date('Y-m-d H:i:s'),
|
|
|
|
|
'module' => 'common'
|
|
|
|
|
]
|
|
|
|
|
]);
|
|
|
|
|
});
|
|
|
|
|
|
2025-03-16 19:24:37 +08:00
|
|
|
// 数据库初始化路由
|
|
|
|
|
Route::get('api/database/init', 'app\\common\\controller\\Database@init');
|
|
|
|
|
Route::get('api/database/test', 'app\\common\\controller\\Database@test');
|
|
|
|
|
Route::get('api/database/update-password', 'app\\common\\controller\\Database@updatePassword');
|
|
|
|
|
Route::get('api/database/debug-password', 'app\\common\\controller\\Database@debugPassword');
|
|
|
|
|
Route::get('api/database/reset-password', 'app\\common\\controller\\Database@resetPassword');
|
2025-03-16 17:43:30 +08:00
|
|
|
|
2025-03-16 19:24:37 +08:00
|
|
|
// 定义RESTful风格的API路由 - 认证相关
|
|
|
|
|
Route::group('api/auth', function () {
|
|
|
|
|
// 无需认证的接口
|
|
|
|
|
Route::post('login', 'app\\common\\controller\\Auth@login'); // 账号密码登录
|
|
|
|
|
Route::post('mobile-login', 'app\\common\\controller\\Auth@mobileLogin'); // 手机号验证码登录
|
|
|
|
|
Route::post('code', 'app\\common\\controller\\Auth@sendCode'); // 发送验证码
|
|
|
|
|
|
|
|
|
|
// 需要JWT认证的接口
|
|
|
|
|
Route::get('info', 'app\\common\\controller\\Auth@info')->middleware(['jwt']); // 获取用户信息
|
|
|
|
|
Route::post('refresh', 'app\\common\\controller\\Auth@refresh')->middleware(['jwt']); // 刷新令牌
|
|
|
|
|
});
|
2025-03-16 17:43:30 +08:00
|
|
|
|
|
|
|
|
return [];
|