zhangyong 1 年之前
父节点
当前提交
014f5bee9a
共有 1 个文件被更改,包括 13 次插入10 次删除
  1. 13 10
      video_agc/agc_video_method.py

+ 13 - 10
video_agc/agc_video_method.py

@@ -31,20 +31,23 @@ 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};"""
                 Common.logger("gs_video").info(f"{mark}sql{url_list} ")
                 url_list = MysqlHelper.get_values(url_list, "prod")
                 Common.logger("gs_video").info(f"{mark}查询数据{url_list} ")