From ca7b9bd48771ce8c8a31d631789ea2cb2784ff0d Mon Sep 17 00:00:00 2001 From: jsasg <735273025@qq.com> Date: Thu, 17 Jul 2025 16:42:59 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96openapi=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E9=A2=91=E7=8E=87=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/openapi/route/v1.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/openapi/route/v1.php b/app/openapi/route/v1.php index 63ed4d95..88b6cabd 100644 --- a/app/openapi/route/v1.php +++ b/app/openapi/route/v1.php @@ -31,7 +31,11 @@ Route::group('v1', function() { ->middleware(\app\openapi\middleware\Auth::class); }) ->middleware(\think\middleware\Throttle::class, [ - 'visit_rate' => '5/m', + 'prefix' => 'throttle_', + 'visit_rate' => '5/m', + 'key' => function($throttle, $request) { + return '__CONTROLLER__/__ACTION__/__IP__'; + }, 'visit_fail_response' => function (\think\middleware\Throttle $throttle, \think\Request $request, int $wait_seconds) { return \think\Response::create('您的操作过于频繁, 请在 ' . $wait_seconds . ' 秒后再试。')->code(429); },