|
@@ -193,6 +193,7 @@ class AiAutoCreative(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)
|
|
@@ -201,7 +202,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(channel_type=df['channel_type'].values[0],account_id=account_id,
|
|
|
|
|
|
+ video_list = get_new_video_info(channel_type=channel_type,account_id=account_id,
|
|
url=get_new_video_url)
|
|
url=get_new_video_url)
|
|
|
|
|
|
# 返回的视频中有通用视频和特定视频,需要分开处理
|
|
# 返回的视频中有通用视频和特定视频,需要分开处理
|
|
@@ -289,7 +290,6 @@ 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')
|
|
@@ -495,12 +495,12 @@ class AiUpCreativeByHour(tornado.web.RequestHandler):
|
|
(account_id, os.getpid(), os.getppid(), data))
|
|
(account_id, os.getpid(), os.getppid(), data))
|
|
try:
|
|
try:
|
|
# 1 从客户策略表中获取该账户下 每个素材搭配的封面个数, 来计算需要补充的素材个数
|
|
# 1 从客户策略表中获取该账户下 每个素材搭配的封面个数, 来计算需要补充的素材个数
|
|
- sql = """select image_cnt from ctop_ai_kuaishou_advertiser_strategy
|
|
|
|
|
|
+ sql = """select image_cnt,channel_type from ctop_ai_kuaishou_advertiser_strategy
|
|
where account_id = %s
|
|
where account_id = %s
|
|
limit 1""" % account_id
|
|
limit 1""" % account_id
|
|
df = pd.read_sql(sql, engine)
|
|
df = pd.read_sql(sql, engine)
|
|
image_cnt = int(df['image_cnt'].values[0])
|
|
image_cnt = int(df['image_cnt'].values[0])
|
|
-
|
|
|
|
|
|
+ channel_type = df['channel_type'].values[0]
|
|
# 2、获取从0点到now()为止,该账户下已有的创意个数 M
|
|
# 2、获取从0点到now()为止,该账户下已有的创意个数 M
|
|
sql = """select count(1) creative_cnt from ctop_kuaishou_creative
|
|
sql = """select count(1) creative_cnt from ctop_kuaishou_creative
|
|
where account_id = %s
|
|
where account_id = %s
|
|
@@ -511,10 +511,8 @@ class AiUpCreativeByHour(tornado.web.RequestHandler):
|
|
(datetime.datetime.now()).strftime('%Y-%m-%d'))
|
|
(datetime.datetime.now()).strftime('%Y-%m-%d'))
|
|
df = pd.read_sql(sql, engine)
|
|
df = pd.read_sql(sql, engine)
|
|
exist_creative_cnt = int(df['creative_cnt'].values[0])
|
|
exist_creative_cnt = int(df['creative_cnt'].values[0])
|
|
-
|
|
|
|
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:
|