소스 검색

limit暂时下线

罗俊辉 1 년 전
부모
커밋
4fd11ba101
1개의 변경된 파일39개의 추가작업 그리고 38개의 파일을 삭제
  1. 39 38
      common/limit.py

+ 39 - 38
common/limit.py

@@ -56,41 +56,42 @@ class AuthorLimit(object):
         """
         限制账号, 服务长沙四名同学
         """
-        if self.mode == "author":
-            tag = self.find_tag(user_id)
-            if tag:
-                AliyunLogger.logging(
-                    code="8807",
-                    platform=self.platform,
-                    mode=self.mode,
-                    env="prod",
-                    message="找到个人账号,{}".format(tag)
-                )
-                R = RedisClient()
-                if R.connect():
-                    tag_count = R.select(tag)
-                    if tag_count:
-                        tag_count = int(tag_count.decode("utf-8"))
-                        if tag_count <= 300:
-                            tag_count += 1
-                            expire_seconds = generate_expire_time()
-                            R.insert(
-                                key=tag, value=tag_count, expire_time=expire_seconds
-                            )
-                            return True
-                        else:
-                            # 报警
-                            return False
-                    else:
-                        tag_count = 1
-                        expire_seconds = generate_expire_time()
-                        R.insert(
-                            key=tag, value=tag_count, expire_time=expire_seconds
-                        )
-                        return True
-                else:
-                    return True
-            else:
-                return True
-        else:
-            return True
+        return True
+        # if self.mode == "author":
+        #     tag = self.find_tag(user_id)
+        #     if tag:
+        #         AliyunLogger.logging(
+        #             code="8807",
+        #             platform=self.platform,
+        #             mode=self.mode,
+        #             env="prod",
+        #             message="找到个人账号,{}".format(tag)
+        #         )
+        #         R = RedisClient()
+        #         if R.connect():
+        #             tag_count = R.select(tag)
+        #             if tag_count:
+        #                 tag_count = int(tag_count.decode("utf-8"))
+        #                 if tag_count <= 300:
+        #                     tag_count += 1
+        #                     expire_seconds = generate_expire_time()
+        #                     R.insert(
+        #                         key=tag, value=tag_count, expire_time=expire_seconds
+        #                     )
+        #                     return True
+        #                 else:
+        #                     # 报警
+        #                     return False
+        #             else:
+        #                 tag_count = 1
+        #                 expire_seconds = generate_expire_time()
+        #                 R.insert(
+        #                     key=tag, value=tag_count, expire_time=expire_seconds
+        #                 )
+        #                 return True
+        #         else:
+        #             return True
+        #     else:
+        #         return True
+        # else:
+        #     return True