zhangyong 3 months ago
parent
commit
ab18eaaa7b
1 changed files with 23 additions and 1 deletions
  1. 23 1
      application/pipeline/pipeline.py

+ 23 - 1
application/pipeline/pipeline.py

@@ -7,6 +7,7 @@ import time
 from application.common.feishu.feishu_utils import FeishuUtils
 
 sys.path.append(os.getcwd())
+from datetime import datetime
 
 from application.common import MysqlHelper, AliyunLogger
 # from application.common.redis.pyredis import RedisClient
@@ -29,6 +30,18 @@ class PiaoQuanPipeline(object):
         self.account = account
         # self.red = RedisClient()
 
+    def feishu_time_list(self):
+        summary = FeishuUtils.get_values_batch("KsoMsyP2ghleM9tzBfmcEEXBnXg", "RuLK77")
+        for row in summary[1:]:
+            channel = row[0]
+            day_count = row[1]
+            if channel:
+                if channel == self.platform:
+                    return day_count
+            else:
+                return None
+        return None
+
     def publish_time_flag(self):
         """
         判断发布时间是否过期
@@ -40,6 +53,9 @@ class PiaoQuanPipeline(object):
         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
+        days_time = self.feishu_time_list()
+        if days_time:
+            days = int(days_time)
         if self.platform == "gongzhonghao":
             if (
                     int(time.time()) - publish_time_stamp
@@ -56,7 +72,13 @@ class PiaoQuanPipeline(object):
                 )
                 return False
         else:
-            if (
+            if days == 0:
+                publish_time_stamp = int(time.time())  # 示例时间戳
+                is_today = datetime.fromtimestamp(publish_time_stamp).date() == datetime.today().date()
+                if not is_today:
+                    return False
+
+            elif (
                     int(time.time()) - publish_time_stamp
                     > 3600 * 24 * days
             ):