zhangyong há 5 meses atrás
pai
commit
2fe04d6370
3 ficheiros alterados com 19 adições e 3 exclusões
  1. 6 0
      common/sql_help.py
  2. 7 3
      job_ks_feed.py
  3. 6 0
      job_sph_feed.py

+ 6 - 0
common/sql_help.py

@@ -77,6 +77,12 @@ class sqlCollect():
             sql=insert_sql
         )
 
+    @classmethod
+    def get_feed_count(cls, channel):
+        sql = """SELECT count(0) FROM machine_making_data where channel = %s and  DATE(data_time) = CURRENT_DATE;"""
+        count = MysqlHelper.get_values(sql, (str(channel)))
+        return count
+
     """
     判断该任务id是否用过
     """

+ 7 - 3
job_ks_feed.py

@@ -1,13 +1,17 @@
-
-import time
 from common import Material
-
+from common.sql_help import sqlCollect
+import time
 from video_rewriting.video_processor import VideoProcessor
 def video_task_start():
     """处理视频任务,返回用户名并根据结果决定延迟时间"""
     data = Material.feishu_list()[18]
     while True:
         try:
+            count = sqlCollect.get_feed_count("快手推荐流")
+            count = int(count[0][0])
+            if count > 100:
+                time.sleep(3600)
+                continue
             print("开始执行任务")
             mark = VideoProcessor.main(data)
             print(f"返回用户名: {mark}")

+ 6 - 0
job_sph_feed.py

@@ -1,6 +1,7 @@
 
 import time
 from common import Material
+from common.sql_help import sqlCollect
 
 from video_rewriting.video_processor import VideoProcessor
 def video_task_start():
@@ -8,6 +9,11 @@ def video_task_start():
     data = Material.feishu_list()[17]
     while True:
         try:
+            count = sqlCollect.get_feed_count("视频号推荐流")
+            count = int(count[0][0])
+            if count > 100:
+                time.sleep(3600)
+                continue
             print("开始执行任务")
             mark = VideoProcessor.main(data)
             print(f"返回用户名: {mark}")