Browse Source

更新 pipeline

罗俊辉 1 year ago
parent
commit
6ea32ea80f
1 changed files with 8 additions and 9 deletions
  1. 8 9
      common/pipeline.py

+ 8 - 9
common/pipeline.py

@@ -18,13 +18,16 @@ class PiaoQuanPipeline:
         # 判断发布时间
         publish_time_stamp = self.item["publish_time_stamp"]
         update_time_stamp = self.item["update_time_stamp"]
+        max_d = self.rule_dict.get("period", {}).get("max", 1000)
+        min_d = self.rule_dict.get("period", {}).get("min", 1000)
+        days = max_d if max_d > min_d else min_d
         if self.platform == "gongzhonghao":
             if (
                 int(time.time()) - publish_time_stamp
-                > 3600 * 24 * int(self.rule_dict.get("period", {}).get("max", 1000))
+                > 3600 * 24 * days
             ) and (
                 int(time.time()) - update_time_stamp
-                > 3600 * 24 * int(self.rule_dict.get("period", {}).get("max", 1000))
+                > 3600 * 24 * days
             ):
                 AliyunLogger.logging(
                     code="2004",
@@ -33,15 +36,13 @@ class PiaoQuanPipeline:
                     mode=self.mode,
                     env=self.env,
                     data=self.item,
-                    message="发布时间超过{}天".format(
-                        int(self.rule_dict.get("period", {}).get("max", 1000))
-                    ),
+                    message="发布时间超过{}天".format(days),
                 )
                 return False
         else:
             if (
                 int(time.time()) - publish_time_stamp
-                > 3600 * 24 * int(self.rule_dict.get("period", {}).get("max", 1000))
+                > 3600 * 24 * days
             ):
                 AliyunLogger.logging(
                     code="2004",
@@ -50,9 +51,7 @@ class PiaoQuanPipeline:
                     mode=self.mode,
                     env=self.env,
                     data=self.item,
-                    message="发布时间超过{}天".format(
-                        int(self.rule_dict.get("period", {}).get("max", 1000))
-                    ),
+                    message="发布时间超过{}天".format(days),
                 )
                 return False
         return True