|
@@ -40,6 +40,8 @@ bei.user_id,
|
|
|
bei.leader_id,
|
|
|
bei.org_code,
|
|
|
report.charge,
|
|
|
+ifnull(ratio.charge,0) last_charge,
|
|
|
+ifnull(round((report.charge-ratio.charge)/ratio.charge*100,3),0) charge_ratio,
|
|
|
report.`show`,
|
|
|
report.photo_click,
|
|
|
report.aclick,
|
|
@@ -321,7 +323,11 @@ 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
|
|
|
-ON report.account_id = bei.account_id;
|
|
|
+ON report.account_id = bei.account_id
|
|
|
+LEFT JOIN (select advertiser_id account_id,round(sum(charge),3) charge from `media_api`.kuaishou_account_report_daily a
|
|
|
+where stat_date between date_format(date_sub(date_format(date_sub({date_time}, INTERVAL 7 DAY),'%Y%m%d'), INTERVAL {day_count}-1 DAY),'%Y%m%d') and date_format(date_sub({date_time}, INTERVAL {day_count} DAY),'%Y%m%d')
|
|
|
+group by advertiser_id) ratio
|
|
|
+ON report.account_id = ratio.account_id;
|
|
|
""".format(date_time=self.date_time, day_count=self.day_count)
|
|
|
TidbConn.upsert(conn=self.conn, sql_buff=sql)
|
|
|
self.conn.commit()
|