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