Quellcode durchsuchen

修改了apiLimit的时间单位为秒

panda vor 6 Monaten
Ursprung
Commit
97b5000ab4

+ 2 - 2
application/api/controller/Gift.php

@@ -84,7 +84,7 @@ class Gift extends Api
     //聊天送礼物
     public function givegift_typing() {
         // 接口防并发
-        if (!$this->apiLimit(1, 1000)) {
+        if (!$this->apiLimit(1, 1)) {
             $this->error(__('Operation frequently'));
         }
 
@@ -245,7 +245,7 @@ class Gift extends Api
     public function givechatgift() {
         exit; //作废
         // 接口防并发
-        if (!$this->apiLimit(1, 1000)) {
+        if (!$this->apiLimit(1, 1)) {
             $this->error(__('Operation frequently'));
         }
 

+ 1 - 1
application/api/controller/Topicdongtai.php

@@ -553,7 +553,7 @@ class Topicdongtai extends Api
     //动态赠送礼物
     public function givegiftdongtai() {
         // 接口防并发
-        if (!$this->apiLimit(1, 1000)) {
+        if (!$this->apiLimit(1, 1)) {
             $this->error(__('Operation frequently'));
         }
 

+ 1 - 1
application/api/controller/User.php

@@ -1199,7 +1199,7 @@ class User extends Api
     public function changeDeviceIp()
     {
         // 接口防并发
-        if (!$this->apiLimit(1, 5000)) {
+        if (!$this->apiLimit(1, 5)) {
             return ;
         }
 

+ 2 - 2
application/api/controller/Usercenter.php

@@ -890,7 +890,7 @@ class Usercenter extends Api
     //开通守护
     public function addguard() {
         // 接口防并发
-        if (!$this->apiLimit(1, 1000)) {
+        if (!$this->apiLimit(1, 1)) {
             $this->error(__('Operation frequently'));
         }
 
@@ -1952,7 +1952,7 @@ $resArray['money'] = $money;  //返回给前端的计算结果
     //男性非会员解锁聊天
     public function unlockchat() {
         // 接口防并发
-        if (!$this->apiLimit(1, 1000)) {
+        if (!$this->apiLimit(1, 1)) {
             $this->error(__('Operation frequently'));
         }
         //男性非会员是否已开通聊天

+ 1 - 1
application/api/controller/Userfollow.php

@@ -94,7 +94,7 @@ class Userfollow extends Api
     //关注某人
     public function follow_one(){
         // 接口防并发
-        if (!$this->apiLimit(1, 1000)) {
+        if (!$this->apiLimit(1, 1)) {
             $this->error(__('Operation frequently'));
         }
 

+ 2 - 2
application/common/controller/Api.php

@@ -447,11 +447,11 @@ class Api
     /**
      * 接口请求限制
      * @param int $apiLimit
-     * @param int $apiLimitTime
+     * @param int $apiLimitTime 单位:秒(s)
      * @param string $key
      * @return bool | true:通过 false:拒绝
      */
-    public function apiLimit($apiLimit = 1, $apiLimitTime = 1000, $key = '')
+    public function apiLimit($apiLimit = 1, $apiLimitTime = 1, $key = '')
     {
         $userId = $this->auth->id;
         $controller = request()->controller();