|
@@ -21,10 +21,10 @@ class AppKuaishouUnitReportBusi:
|
|
|
|
|
|
def taskHandler(self):
|
|
|
try:
|
|
|
- sql_porject = """select project_id from `jeecg-boot`.ctop_user_allocation where media_id=2
|
|
|
-group by project_id """
|
|
|
- project_list = TidbConn.quary(self.conn, sql_porject)
|
|
|
- for project_id in project_list:
|
|
|
+ sql_porject = """select account_id from `jeecg-boot`.ctop_user_allocation where media_id=2
|
|
|
+group by account_id """
|
|
|
+ account_list = TidbConn.quary(self.conn, sql_porject)
|
|
|
+ for account_id in account_list:
|
|
|
try:
|
|
|
sql = """SET sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
|
|
|
REPLACE INTO application.app_kuaishou_unit_report_busi_{day_count}d
|
|
@@ -305,7 +305,9 @@ round(sum(ad_photo_played_2s_ratio)/{day_count}*100,3) ad_photo_played_2s_ratio,
|
|
|
round(sum(event_outbound_call_ratio)/sum(activation)*100,3) event_outbound_call_ratio,
|
|
|
sum(event_ad_watch_times) event_ad_watch_times
|
|
|
from
|
|
|
- media_api.kuaishou_unit_report_daily a where stat_date >= date_format(date_sub({date_time}, INTERVAL ({day_count} -1 ) DAY),'%Y%m%d')
|
|
|
+ media_api.kuaishou_unit_report_daily a
|
|
|
+where stat_date >= date_format(date_sub({date_time}, INTERVAL ({day_count} -1 ) DAY),'%Y%m%d')
|
|
|
+and advertiser_id={account_id}
|
|
|
group by advertiser_id,campaign_id,campaign_name,unit_id,unit_name) report
|
|
|
LEFT JOIN (
|
|
|
SELECT
|
|
@@ -331,10 +333,10 @@ LEFT JOIN `jeecg-boot`.sys_user su ON su.id = cua.user_id
|
|
|
LEFT JOIN `jeecg-boot`.user_company uc ON uc.user_id = cua.user_id
|
|
|
LEFT JOIN `jeecg-boot`.ctop_product product ON product.id = cp.product_id
|
|
|
WHERE
|
|
|
-cua.account_id IS NOT NULL) bei
|
|
|
+cua.account_id IS NOT NULL
|
|
|
+and cua.account_id ={account_id}) bei
|
|
|
ON report.account_id = bei.account_id
|
|
|
-where bei.project_id={project_id}
|
|
|
-;""".format(date_time=self.date_time, day_count=self.day_count, project_id=project_id[0])
|
|
|
+;""".format(date_time=self.date_time, day_count=self.day_count, account_id=account_id[0])
|
|
|
print(sql)
|
|
|
TidbConn.upsert(conn=self.conn, sql_buff=sql)
|
|
|
self.conn.commit()
|