浏览代码

送礼物防高并发

lizhen_gitee 1 年之前
父节点
当前提交
7c0abe7ee5
共有 2 个文件被更改,包括 9 次插入4 次删除
  1. 4 4
      application/api/controller/Party.php
  2. 5 0
      application/index/controller/User.php

+ 4 - 4
application/api/controller/Party.php

@@ -1590,17 +1590,17 @@ class Party extends Common
         $is_back = $this->request->request("is_back",0);
 
         // 接口防并发
-       /* if($is_back){
+        if($is_back){
             if (!$this->apiLimit(50, 1000)) {
                 //1000毫秒50次
-                $this->error(__('Operation frequently'));
+                $this->error('休息一下吧');
             }
         }else{
             if (!$this->apiLimit(10, 1000)) {
                 //1000毫秒10次
-                $this->error(__('Operation frequently'));
+                $this->error('休息一下吧');
             }
-        }*/
+        }
 
         //送礼物权限
         if($this->auth->power['give_gift'] == 1){

+ 5 - 0
application/index/controller/User.php

@@ -22,6 +22,11 @@ class User extends Frontend
     protected $noNeedLogin = ['login', 'register', 'third'];
     protected $noNeedRight = ['*'];
 
+    public function __construct()
+    {
+        exit;
+    }
+
     public function _initialize()
     {
         parent::_initialize();