Kaynağa Gözat

压测,临时去掉接口访问限制

lizhen_gitee 1 gün önce
ebeveyn
işleme
f45b52eee5

+ 2 - 2
app/Controller/Api/v1/PlayerController.php

@@ -40,9 +40,9 @@ class PlayerController extends AbstractController
             return AppResult::error('活动在'.site('subject_endtime').'就结束了');
         }
 
-        if (!RedisUtil::getInstance(RedisKeyEnum::API_REQUEST_TRAFFIC)->tryTimes(1, 3)) {
+        /*if (!RedisUtil::getInstance(RedisKeyEnum::API_REQUEST_TRAFFIC)->tryTimes(1, 3)) {
             return AppResult::error('操作太快了,休息一下吧');
-        }
+        }*/
 
         $params = $request->validated();// 获取校验通过的参数
         $user   = AuthUser::getInstance()->get();

+ 2 - 2
app/Controller/Api/v1/QuestionController.php

@@ -94,9 +94,9 @@ class QuestionController extends AbstractController
             return AppResult::error('活动在'.site('subject_endtime').'就结束了');
         }
 
-        if (!RedisUtil::getInstance(RedisKeyEnum::API_REQUEST_TRAFFIC)->tryTimes(1, 3)) {
+        /*if (!RedisUtil::getInstance(RedisKeyEnum::API_REQUEST_TRAFFIC)->tryTimes(1, 3)) {
             return AppResult::error('操作太快了,休息一下吧');
-        }
+        }*/
 
         $params = $request->validated();// 获取校验通过的参数
         $user   = AuthUser::getInstance()->get();

+ 2 - 2
app/Middleware/ApiAgent.php

@@ -70,10 +70,10 @@ class ApiAgent implements MiddlewareInterface
         LogUtil::info('请求参数', $action['controller'], $action['action'], $params);
 
         //接口限流,写到中间件中
-        if (!RedisUtil::getInstance(RedisKeyEnum::API_REQUEST_TRAFFIC)->requestLimit("{$action['controller']}/{$action['action']}", 1, 20000)) {
+        /*if (!RedisUtil::getInstance(RedisKeyEnum::API_REQUEST_TRAFFIC)->requestLimit("{$action['controller']}/{$action['action']}", 1, 20000)) {
             LogUtil::info('当前访问人数过多,请稍后再试', $action['controller'], $action['action']);
             return $this->response206();
-        }
+        }*/
 
         $token = $this->request->header('token');
         if (empty($token)) $token = $params['token'] ?? '';