zhangyong 1 year ago
parent
commit
8a672370b9
2 changed files with 23 additions and 12 deletions
  1. 2 2
      agc_main.py
  2. 21 10
      video_agc/agc_video_method.py

+ 2 - 2
agc_main.py

@@ -24,8 +24,8 @@ def video_start(user_data):
             Common.logger("video").info(f"返回用户名{mark}")
             returned_usernames_today.append(user_data_mark)
 
-# name_list = Material.feishu_list()
-# video_start(name_list[1])
+name_list = Material.feishu_list()
+video_start(name_list[1])
 
 
 

+ 21 - 10
video_agc/agc_video_method.py

@@ -76,20 +76,31 @@ class AgcVidoe():
             formatted_current_time = current_time.strftime("%Y-%m-%d")
             formatted_three_days_ago = three_days_ago.strftime("%Y-%m-%d")
             if limit_count == 1:
-                url_list = f"""SELECT a.video_id,a.account_id,a.oss_object_key FROM agc_video_url a WHERE NOT EXISTS (
-                                    SELECT video_id
-                                    FROM agc_video_deposit b
-                                    WHERE a.oss_object_key = b.oss_object_key AND b.time = '{formatted_current_time}'
-                                ) AND a.account_id = {user} and a.`status` = 1 and a.mark = '{mark}' limit {limit_count};"""
+                url_list = f"""SELECT a.video_id, a.account_id, a.oss_object_key 
+                                               FROM agc_video_url a 
+                                               LEFT JOIN agc_video_deposit b 
+                                               ON a.oss_object_key = b.oss_object_key 
+                                               AND b.time = '{formatted_current_time}' 
+                                               WHERE b.video_id IS NULL 
+                                               AND a.account_id = {user} 
+                                               AND a.status = 1 
+                                               AND a.mark = '{mark}' 
+                                               LIMIT {limit_count};"""
                 url_list = MysqlHelper.get_values(url_list, "prod")
                 if url_list:
                         return url_list
             else:
-                url_list = f"""SELECT a.video_id,a.account_id,a.oss_object_key FROM agc_video_url a WHERE NOT EXISTS (
-                                                    SELECT video_id
-                                                    FROM agc_video_deposit b
-                                                    WHERE a.oss_object_key = b.oss_object_key AND b.time >= '{formatted_three_days_ago}' AND b.time <= '{formatted_current_time}'
-                                                ) AND a.account_id = {user} and a.`status` = 1 and a.mark = '{mark}' limit {limit_count};"""
+                url_list = f"""SELECT a.video_id, a.account_id, a.oss_object_key 
+                                              FROM agc_video_url a 
+                                              LEFT JOIN agc_video_deposit b 
+                                              ON a.oss_object_key = b.oss_object_key 
+                                              AND b.time >= '{formatted_three_days_ago}' 
+                                              AND b.time <= '{formatted_current_time}' 
+                                              WHERE b.video_id IS NULL 
+                                              AND a.account_id = {user} 
+                                              AND a.status = 1 
+                                              AND a.mark = '{mark}' 
+                                              LIMIT {limit_count};"""
                 url_list = MysqlHelper.get_values(url_list, "prod")
                 if url_list:
                     if len(url_list) >= 30: