Ver Fonte

历史遗漏视频添加 开始时间 和结束时间

liyuyi@c-top.com.cn há 4 anos atrás
pai
commit
941f860f7c
3 ficheiros alterados com 21 adições e 8 exclusões
  1. 5 1
      ai_time_task_creative_handler.py
  2. 2 2
      utils/CommonFunction.py
  3. 14 5
      utils/ConstantConfig.py

+ 5 - 1
ai_time_task_creative_handler.py

@@ -31,7 +31,11 @@ class AiHistoricalMissingMaterial(tornado.web.RequestHandler):
         account_id = data.get('account_id')
         campaign_id = data.get('campaign_id')
         try:
-            video_info = get_missing_video_info(account_id, historical_missing_video_cnt, get_missing_video_url)
+            video_info = get_missing_video_info(account_id,
+                                                missing_video_cnt,
+                                                get_missing_video_url,
+                                                missing_video_start_time,
+                                                missing_video_end_time)
             if video_info is None:
                 self.write(json.dumps({"message": "没有获取到视频,不发送ai策略请求!"}))
                 self.flush()

+ 2 - 2
utils/CommonFunction.py

@@ -23,8 +23,8 @@ def get_new_video_info(account_id, url):
     return request['data']
 
 
-def get_missing_video_info(account_id, cnt, url):
-    request_data = {"accountId": account_id, "videoCnt": cnt}
+def get_missing_video_info(account_id, cnt, url, start_time, end_time):
+    request_data = {"accountId": account_id, "videoCnt": cnt, "startTime": start_time, "endTime": end_time}
     request = requests.post(url, headers=headers, data=json.JSONEncoder().encode(request_data)).text
     request = json.loads(request)
     if request['code'] != 0:

+ 14 - 5
utils/ConstantConfig.py

@@ -1,20 +1,29 @@
 import os
+import datetime
 # 账户当天创意上新数
 full_creative_cnt = 2000
 
 os_env_code_status = os.getenv('LYY_STATUS', 'product')
 if os_env_code_status == 'dev':
-    # 补充历史遗落素材的个数
-    historical_missing_video_cnt = 2
     # 近多少天的爆量视频
     high_quality_video_days = 14
     high_quality_video_cnt = 2
+
+    # 遗漏视频的开始时间  和 结束时间
+    missing_video_start_time = (datetime.datetime.now() + datetime.timedelta(days=-60)).strftime("%Y-%m-%d")
+    missing_video_end_time = str(datetime.date.today())
+    # 补充历史遗漏素材的个数
+    missing_video_cnt = 2
 else:
-    # 补充历史遗落素材的个数
-    historical_missing_video_cnt = 2
     # 近多少天的爆量视频
     high_quality_video_days = 14
-    high_quality_video_cnt = 2
+    high_quality_video_cnt = 100
+
+    # 遗漏视频的开始时间  和 结束时间
+    missing_video_start_time = (datetime.datetime.now() + datetime.timedelta(days=-60)).strftime("%Y-%m-%d")
+    missing_video_end_time = str(datetime.date.today())
+    # 补充历史遗落素材的个数
+    missing_video_cnt = 100