33 lines
1.3 KiB
PHP
33 lines
1.3 KiB
PHP
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
|
// +----------------------------------------------------------------------
|
|
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
|
|
// +----------------------------------------------------------------------
|
|
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
|
// +----------------------------------------------------------------------
|
|
// | Author: liu21st <liu21st@gmail.com>
|
|
// +----------------------------------------------------------------------
|
|
use think\facade\Route;
|
|
|
|
// v1版本路由定义
|
|
Route::group('v1', function () {
|
|
// 用户模块
|
|
Route::group('user', function () {
|
|
// 获取验证码
|
|
Route::get('captcha', 'Captcha/index')->middleware(\think\middleware\Throttle::class, [
|
|
'visit_rate' => '5/m',
|
|
'visit_fail_response' => function (\think\middleware\Throttle $throttle, \think\Request $request, int $wait_seconds) {
|
|
return \think\Response::create('您的操作过于频繁, 请在 ' . $wait_seconds . ' 秒后再试。')->code(429);
|
|
},
|
|
]);
|
|
|
|
// 登录接口
|
|
Route::post('login', 'Login/index');
|
|
});
|
|
})->prefix('v1.');
|
|
|
|
Route::miss(function() {
|
|
return '404 Not Found!';
|
|
});
|