|
@@ -46,6 +46,7 @@ class AiHistoricalMissingMaterial(tornado.web.RequestHandler):
|
|
where account_id=%s order by create_time desc limit 1
|
|
where account_id=%s order by create_time desc limit 1
|
|
""" % account_id
|
|
""" % account_id
|
|
df = pd.read_sql(sql, engine)
|
|
df = pd.read_sql(sql, engine)
|
|
|
|
+ channel_type = df['channel_type'].values[0]
|
|
if df['general_track'].values[0] == 0:
|
|
if df['general_track'].values[0] == 0:
|
|
app_id_array = eval(df['app_id_array'].values[0])
|
|
app_id_array = eval(df['app_id_array'].values[0])
|
|
app_list = get_app_list(account_id=account_id, url=get_app_list_url)
|
|
app_list = get_app_list(account_id=account_id, url=get_app_list_url)
|
|
@@ -54,7 +55,8 @@ class AiHistoricalMissingMaterial(tornado.web.RequestHandler):
|
|
for app_info in app_list['data']:
|
|
for app_info in app_list['data']:
|
|
if app_info['appId'] in app_id_array:
|
|
if app_info['appId'] in app_id_array:
|
|
app_dict[app_info['appVersion']] = app_info
|
|
app_dict[app_info['appVersion']] = app_info
|
|
- video_list = get_missing_video_info(account_id=account_id,
|
|
|
|
|
|
+ video_list = get_missing_video_info(channel_type=channel_type,
|
|
|
|
+ account_id=account_id,
|
|
cnt=test_video_cnt if test_video_cnt else missing_video_cnt,
|
|
cnt=test_video_cnt if test_video_cnt else missing_video_cnt,
|
|
url=get_missing_video_url,
|
|
url=get_missing_video_url,
|
|
start_time=missing_video_start_time,
|
|
start_time=missing_video_start_time,
|
|
@@ -131,7 +133,8 @@ class AiHistoricalMissingMaterial(tornado.web.RequestHandler):
|
|
self.write(json.dumps({"message": "account_id=%s, 多应用的补充遗漏素材请求已走完!" % account_id}))
|
|
self.write(json.dumps({"message": "account_id=%s, 多应用的补充遗漏素材请求已走完!" % account_id}))
|
|
self.flush()
|
|
self.flush()
|
|
else:
|
|
else:
|
|
- video_info = get_missing_video_info(account_id=account_id,
|
|
|
|
|
|
+ video_info = get_missing_video_info(channel_type=channel_type,
|
|
|
|
+ account_id=account_id,
|
|
cnt=test_video_cnt if test_video_cnt else missing_video_cnt,
|
|
cnt=test_video_cnt if test_video_cnt else missing_video_cnt,
|
|
url=get_missing_video_url,
|
|
url=get_missing_video_url,
|
|
start_time=missing_video_start_time,
|
|
start_time=missing_video_start_time,
|
|
@@ -198,7 +201,7 @@ class AiAutoCreative(tornado.web.RequestHandler):
|
|
for app_info in app_list['data']:
|
|
for app_info in app_list['data']:
|
|
if app_info['appId'] in app_id_array:
|
|
if app_info['appId'] in app_id_array:
|
|
app_dict[app_info['appVersion']] = app_info
|
|
app_dict[app_info['appVersion']] = app_info
|
|
- video_list = get_new_video_info(account_id=account_id,
|
|
|
|
|
|
+ video_list = get_new_video_info(channel_type=df['channel_type'].values[0],account_id=account_id,
|
|
url=get_new_video_url)
|
|
url=get_new_video_url)
|
|
|
|
|
|
# 返回的视频中有通用视频和特定视频,需要分开处理
|
|
# 返回的视频中有通用视频和特定视频,需要分开处理
|
|
@@ -286,12 +289,14 @@ class AiAutoCreative(tornado.web.RequestHandler):
|
|
and put_create_time <= '%s'
|
|
and put_create_time <= '%s'
|
|
""" % (account_id, start_time, end_time)
|
|
""" % (account_id, start_time, end_time)
|
|
df = pd.read_sql(sql, engine)
|
|
df = pd.read_sql(sql, engine)
|
|
|
|
+ channel_type = df['channel_type'].values[0]
|
|
for row in df.itertuples():
|
|
for row in df.itertuples():
|
|
if '素材自动上新' in getattr(row, 'campaign_name'):
|
|
if '素材自动上新' in getattr(row, 'campaign_name'):
|
|
campaign_id = getattr(row, 'campaign_id')
|
|
campaign_id = getattr(row, 'campaign_id')
|
|
break
|
|
break
|
|
|
|
|
|
- video_info = get_new_video_info(account_id=account_id,
|
|
|
|
|
|
+ video_info = get_new_video_info(channel_type=channel_type,
|
|
|
|
+ account_id=account_id,
|
|
url=get_new_video_url)
|
|
url=get_new_video_url)
|
|
if video_info['code'] != 0:
|
|
if video_info['code'] != 0:
|
|
self.write(json.dumps({"account_id": account_id, "message": "素材自动上新没有获取到视频,不发送ai策略请求!"}))
|
|
self.write(json.dumps({"account_id": account_id, "message": "素材自动上新没有获取到视频,不发送ai策略请求!"}))
|
|
@@ -341,6 +346,7 @@ class AiHighQualityMaterial(tornado.web.RequestHandler):
|
|
where account_id=%s order by create_time desc limit 1
|
|
where account_id=%s order by create_time desc limit 1
|
|
""" % account_id
|
|
""" % account_id
|
|
df = pd.read_sql(sql, engine)
|
|
df = pd.read_sql(sql, engine)
|
|
|
|
+ channel_type = df['channel_type'].values[0]
|
|
if df['general_track'].values[0] == 0:
|
|
if df['general_track'].values[0] == 0:
|
|
app_id_array = eval(df['app_id_array'].values[0])
|
|
app_id_array = eval(df['app_id_array'].values[0])
|
|
app_list = get_app_list(account_id=account_id, url=get_app_list_url)
|
|
app_list = get_app_list(account_id=account_id, url=get_app_list_url)
|
|
@@ -349,7 +355,8 @@ class AiHighQualityMaterial(tornado.web.RequestHandler):
|
|
for app_info in app_list['data']:
|
|
for app_info in app_list['data']:
|
|
if app_info['appId'] in app_id_array:
|
|
if app_info['appId'] in app_id_array:
|
|
app_dict[app_info['appVersion']] = app_info
|
|
app_dict[app_info['appVersion']] = app_info
|
|
- video_list = get_top_video_info(account_id=account_id,
|
|
|
|
|
|
+ video_list = get_top_video_info(channel_type=channel_type,
|
|
|
|
+ account_id=account_id,
|
|
cnt=high_quality_video_cnt,
|
|
cnt=high_quality_video_cnt,
|
|
start_time=(datetime.datetime.now() +
|
|
start_time=(datetime.datetime.now() +
|
|
datetime.timedelta(days=-high_quality_video_days)).
|
|
datetime.timedelta(days=-high_quality_video_days)).
|
|
@@ -432,7 +439,8 @@ class AiHighQualityMaterial(tornado.web.RequestHandler):
|
|
self.write(json.dumps({"message": "account_id=%s, 多应用的高质量素材复建请求已走完!" % account_id}))
|
|
self.write(json.dumps({"message": "account_id=%s, 多应用的高质量素材复建请求已走完!" % account_id}))
|
|
self.flush()
|
|
self.flush()
|
|
else:
|
|
else:
|
|
- video_info = get_top_video_info(account_id=account_id,
|
|
|
|
|
|
+ video_info = get_top_video_info(channel_type=channel_type,
|
|
|
|
+ account_id=account_id,
|
|
cnt=high_quality_video_cnt,
|
|
cnt=high_quality_video_cnt,
|
|
start_time=(datetime.datetime.now() +
|
|
start_time=(datetime.datetime.now() +
|
|
datetime.timedelta(days=-high_quality_video_days)).
|
|
datetime.timedelta(days=-high_quality_video_days)).
|
|
@@ -506,6 +514,7 @@ class AiUpCreativeByHour(tornado.web.RequestHandler):
|
|
|
|
|
|
now_hour = datetime.datetime.now().hour
|
|
now_hour = datetime.datetime.now().hour
|
|
now = datetime.datetime.now()
|
|
now = datetime.datetime.now()
|
|
|
|
+ channel_type = df['channel_type'].values[0]
|
|
should_creative_cnt = now_hour * 100
|
|
should_creative_cnt = now_hour * 100
|
|
# 3、计算需要补充的创意个数和视频个数,并按当前小时值,补充不同类似的视频
|
|
# 3、计算需要补充的创意个数和视频个数,并按当前小时值,补充不同类似的视频
|
|
if exist_creative_cnt < should_creative_cnt:
|
|
if exist_creative_cnt < should_creative_cnt:
|
|
@@ -514,7 +523,8 @@ class AiUpCreativeByHour(tornado.web.RequestHandler):
|
|
if now_hour % 5 == 0:
|
|
if now_hour % 5 == 0:
|
|
# campaign_group_name_place 用于广告计划和广告组名称的标识
|
|
# campaign_group_name_place 用于广告计划和广告组名称的标识
|
|
campaign_group_name_place = "高质量素材"
|
|
campaign_group_name_place = "高质量素材"
|
|
- video_list = get_top_video_info(account_id=account_id,
|
|
|
|
|
|
+ video_list = get_top_video_info(channel_type=channel_type,
|
|
|
|
+ account_id=account_id,
|
|
url=get_high_quality_video_url,
|
|
url=get_high_quality_video_url,
|
|
start_time=(now + datetime.timedelta(days=-high_quality_video_days)).
|
|
start_time=(now + datetime.timedelta(days=-high_quality_video_days)).
|
|
strftime("%Y-%m-%d %H:%M:%S"),
|
|
strftime("%Y-%m-%d %H:%M:%S"),
|
|
@@ -524,7 +534,8 @@ class AiUpCreativeByHour(tornado.web.RequestHandler):
|
|
app_version=None)
|
|
app_version=None)
|
|
elif (now_hour % 5 == 1) or (now_hour % 5 == 2):
|
|
elif (now_hour % 5 == 1) or (now_hour % 5 == 2):
|
|
campaign_group_name_place = "历史素材打捞"
|
|
campaign_group_name_place = "历史素材打捞"
|
|
- video_list = get_history_video_info(account_id=account_id,
|
|
|
|
|
|
+ video_list = get_history_video_info(channel_type=channel_type,
|
|
|
|
+ account_id=account_id,
|
|
url=get_history_video_url,
|
|
url=get_history_video_url,
|
|
start_time=history_video_start_time,
|
|
start_time=history_video_start_time,
|
|
end_time=history_video_end_time,
|
|
end_time=history_video_end_time,
|
|
@@ -532,7 +543,8 @@ class AiUpCreativeByHour(tornado.web.RequestHandler):
|
|
related_creative_max_cnt=related_creative_max_cnt)
|
|
related_creative_max_cnt=related_creative_max_cnt)
|
|
else:
|
|
else:
|
|
campaign_group_name_place = "遗漏素材"
|
|
campaign_group_name_place = "遗漏素材"
|
|
- video_list = get_missing_video_info(account_id=account_id,
|
|
|
|
|
|
+ video_list = get_missing_video_info(channel_type=channel_type,
|
|
|
|
+ account_id=account_id,
|
|
cnt=need_video_cnt,
|
|
cnt=need_video_cnt,
|
|
url=get_missing_video_url,
|
|
url=get_missing_video_url,
|
|
start_time=missing_video_start_time,
|
|
start_time=missing_video_start_time,
|
|
@@ -712,6 +724,7 @@ class AiProgramCreativeHighQualityMaterial(tornado.web.RequestHandler):
|
|
where account_id=%s order by create_time desc limit 1
|
|
where account_id=%s order by create_time desc limit 1
|
|
""" % account_id
|
|
""" % account_id
|
|
df = pd.read_sql(sql, engine)
|
|
df = pd.read_sql(sql, engine)
|
|
|
|
+ channel_type = df['channel_type'].values[0]
|
|
if df['general_track'].values[0] == 0:
|
|
if df['general_track'].values[0] == 0:
|
|
app_id_array = eval(df['app_id_array'].values[0])
|
|
app_id_array = eval(df['app_id_array'].values[0])
|
|
app_list = get_app_list(account_id=account_id, url=get_app_list_url)
|
|
app_list = get_app_list(account_id=account_id, url=get_app_list_url)
|
|
@@ -720,7 +733,8 @@ class AiProgramCreativeHighQualityMaterial(tornado.web.RequestHandler):
|
|
for app_info in app_list['data']:
|
|
for app_info in app_list['data']:
|
|
if app_info['appId'] in app_id_array:
|
|
if app_info['appId'] in app_id_array:
|
|
app_dict[app_info['appVersion']] = app_info
|
|
app_dict[app_info['appVersion']] = app_info
|
|
- video_list = get_top_video_info(account_id=account_id,
|
|
|
|
|
|
+ video_list = get_top_video_info(channel_type=channel_type,
|
|
|
|
+ account_id=account_id,
|
|
cnt=multi_app_id_programme_high_quality_video_cnt,
|
|
cnt=multi_app_id_programme_high_quality_video_cnt,
|
|
start_time=(datetime.datetime.now() + datetime.timedelta(
|
|
start_time=(datetime.datetime.now() + datetime.timedelta(
|
|
days=-high_quality_video_days)).strftime("%Y-%m-%d %H:%M:%S"),
|
|
days=-high_quality_video_days)).strftime("%Y-%m-%d %H:%M:%S"),
|
|
@@ -832,7 +846,8 @@ class AiProgramCreativeHighQualityMaterial(tornado.web.RequestHandler):
|
|
self.write(json.dumps({"message": "account_id=%s, 程序化高质量素材请求已走完!" % account_id}))
|
|
self.write(json.dumps({"message": "account_id=%s, 程序化高质量素材请求已走完!" % account_id}))
|
|
self.flush()
|
|
self.flush()
|
|
else:
|
|
else:
|
|
- video_info = get_top_video_info(account_id=account_id,
|
|
|
|
|
|
+ video_info = get_top_video_info(channel_type=channel_type,
|
|
|
|
+ account_id=account_id,
|
|
cnt=programme_high_quality_video_cnt,
|
|
cnt=programme_high_quality_video_cnt,
|
|
start_time=(datetime.datetime.now() + datetime.timedelta(
|
|
start_time=(datetime.datetime.now() + datetime.timedelta(
|
|
days=-high_quality_video_days)).strftime("%Y-%m-%d %H:%M:%S"),
|
|
days=-high_quality_video_days)).strftime("%Y-%m-%d %H:%M:%S"),
|
|
@@ -892,6 +907,7 @@ class AiProgramCreativeNewMaterial(tornado.web.RequestHandler):
|
|
where account_id=%s order by create_time desc limit 1
|
|
where account_id=%s order by create_time desc limit 1
|
|
""" % account_id
|
|
""" % account_id
|
|
df = pd.read_sql(sql, engine)
|
|
df = pd.read_sql(sql, engine)
|
|
|
|
+ channel_type = df['channel_type'].values[0]
|
|
if df['general_track'].values[0] == 0:
|
|
if df['general_track'].values[0] == 0:
|
|
app_id_array = eval(df['app_id_array'].values[0])
|
|
app_id_array = eval(df['app_id_array'].values[0])
|
|
app_list = get_app_list(account_id=account_id, url=get_app_list_url)
|
|
app_list = get_app_list(account_id=account_id, url=get_app_list_url)
|
|
@@ -900,7 +916,8 @@ class AiProgramCreativeNewMaterial(tornado.web.RequestHandler):
|
|
for app_info in app_list['data']:
|
|
for app_info in app_list['data']:
|
|
if app_info['appId'] in app_id_array:
|
|
if app_info['appId'] in app_id_array:
|
|
app_dict[app_info['appVersion']] = app_info
|
|
app_dict[app_info['appVersion']] = app_info
|
|
- video_list = get_history_video_info(account_id=account_id,
|
|
|
|
|
|
+ video_list = get_history_video_info(channel_type=channel_type,
|
|
|
|
+ account_id=account_id,
|
|
url=get_history_video_url,
|
|
url=get_history_video_url,
|
|
start_time=(datetime.datetime.now() + datetime.timedelta(days=-7)).
|
|
start_time=(datetime.datetime.now() + datetime.timedelta(days=-7)).
|
|
strftime("%Y-%m-%d %H:%M:%S"),
|
|
strftime("%Y-%m-%d %H:%M:%S"),
|
|
@@ -1014,7 +1031,8 @@ class AiProgramCreativeNewMaterial(tornado.web.RequestHandler):
|
|
self.write(json.dumps({"message": "account_id=%s, 程序化上新素材请求已走完!" % account_id}))
|
|
self.write(json.dumps({"message": "account_id=%s, 程序化上新素材请求已走完!" % account_id}))
|
|
self.flush()
|
|
self.flush()
|
|
else:
|
|
else:
|
|
- video_info = get_history_video_info(account_id=account_id,
|
|
|
|
|
|
+ video_info = get_history_video_info(channel_type=channel_type,
|
|
|
|
+ account_id=account_id,
|
|
url=get_history_video_url,
|
|
url=get_history_video_url,
|
|
start_time=(datetime.datetime.now() + datetime.timedelta(days=-7)).
|
|
start_time=(datetime.datetime.now() + datetime.timedelta(days=-7)).
|
|
strftime("%Y-%m-%d %H:%M:%S"),
|
|
strftime("%Y-%m-%d %H:%M:%S"),
|