Ver Fonte

新增读取新版自动投放中开启系统优选的账户

liyuyi@c-top.com.cn há 3 anos atrás
pai
commit
40c7669f1a
1 ficheiros alterados com 10 adições e 4 exclusões
  1. 10 4
      time_task_create_ad_by_target.py

+ 10 - 4
time_task_create_ad_by_target.py

@@ -31,17 +31,23 @@ project_ids = project_ids if len(project_ids) > 1 else project_ids * 2
 unique_uuid = str(uuid.uuid4())
 logger.info(f"*******优质定向创建-Start, unique_uuid = {unique_uuid} ,  {datetime.datetime.now()} ********")
 # 1、获取配置了【优质定向】的 account_id 及其 project_id
+# 旧版自动投放策略: ctop_ai_kuaishou_advertiser_strategy
+# 新版自动投放策略: ctop_ai_kuaishou_account_auto_strategy
 # system_optimization 是开启系统优选  0否 1是
-sql = f"select t1.account_id, t2.project_id " \
-      f"from (select account_id from ctop_ai_kuaishou_advertiser_strategy where status = 1 and system_optimization = 1) t1 " \
-      f"left join (select project_id, account_id from ctop_user_allocation where project_id in {tuple(project_ids)} and account_status = 0) t2 " \
+
+sql = f"select t1.account_id, t2.project_id from " \
+      f"(select account_id from ctop_ai_kuaishou_advertiser_strategy where status = 1 and system_optimization = 1 " \
+      f"union select account_id from ctop_ai_kuaishou_account_auto_strategy where status = 1 and system_optimization = 1) t1 " \
+      f"left join " \
+      f"(select project_id, account_id from ctop_user_allocation where project_id in {tuple(project_ids)} and account_status = 0) t2 " \
       f"on t1.account_id = t2.account_id " \
-      f"where t2.account_id is not null"
+      f"where t2.project_id is not null"
 
 account_df = pd.read_sql(sql, jeecg_product_db)
 account_df.drop_duplicates('account_id', keep='first', inplace=True)
 acc_list = [(int(item['account_id']), int(item['project_id'])) for index, item in account_df.iterrows()]
 
+
 # TODO 注释测试代码 for test
 # acc_list = [(10456827, 458), (9774238, 458)]
 # acc_list = [(10456827, 458), (9774238, 458)]