2025-03-16 17:43:30 +08:00
|
|
|
<?php
|
|
|
|
|
// common模块路由配置
|
|
|
|
|
|
|
|
|
|
use think\facade\Route;
|
|
|
|
|
|
2025-03-16 19:24:37 +08:00
|
|
|
// 定义RESTful风格的API路由 - 认证相关
|
2025-03-17 11:47:42 +08:00
|
|
|
Route::group('v1/auth', function () {
|
2025-03-16 19:24:37 +08:00
|
|
|
// 无需认证的接口
|
2025-04-30 14:52:51 +08:00
|
|
|
Route::post('login', 'app\common\controller\PasswordLoginController@index'); // 账号密码登录
|
|
|
|
|
Route::post('mobile-login', 'app\common\controller\Auth@mobileLogin'); // 手机号验证码登录
|
|
|
|
|
Route::post('code', 'app\common\controller\Auth@SendCodeController'); // 发送验证码
|
2025-03-16 19:24:37 +08:00
|
|
|
|
|
|
|
|
// 需要JWT认证的接口
|
2025-04-30 14:52:51 +08:00
|
|
|
Route::get('info', 'app\common\controller\Auth@info')->middleware(['jwt']); // 获取用户信息
|
|
|
|
|
Route::post('refresh', 'app\common\controller\Auth@refresh')->middleware(['jwt']); // 刷新令牌
|
2025-03-21 09:21:11 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 附件上传相关路由
|
|
|
|
|
Route::group('v1/', function () {
|
2025-04-30 14:52:51 +08:00
|
|
|
Route::post('attachment/upload', 'app\common\controller\Attachment@upload'); // 上传附件
|
|
|
|
|
Route::get('attachment/:id', 'app\common\controller\Attachment@info'); // 获取附件信息
|
2025-03-21 09:21:11 +08:00
|
|
|
})->middleware(['jwt']);
|