|
@@ -321,8 +321,8 @@ def pitcher_overview(start, end, pitcher, page, page_size, order_by, order):
|
|
|
sum(first_order_amount) first_amount,
|
|
|
round(sum(reg_amount)/sum(cost),4) roi,
|
|
|
round(sum(first_order_amount)/sum(cost),4) first_roi,
|
|
|
- round(sum(d7)/sum(cost),4) roi7,
|
|
|
- round(sum(d30)/sum(cost),4) roi30,
|
|
|
+ round(sum(d7)/sum(if(dt>=SUBDATE(CURRENT_DATE,INTERVAL 5 day),0,cost)),4) roi7,
|
|
|
+ round(sum(d30)/sum(if(dt>=SUBDATE(CURRENT_DATE,INTERVAL 5 day),0,cost)),4) roi30,
|
|
|
sum(reg_amount-cost) profit,
|
|
|
round(sum(click_count)/sum(view_count),4) click_rate,
|
|
|
round(sum(follow_user)/sum(click_count),4) follow_rate,
|
|
@@ -339,8 +339,35 @@ def pitcher_overview(start, end, pitcher, page, page_size, order_by, order):
|
|
|
round(sum(reg_amount)/sum(reg_order_user),2) avg_amount,
|
|
|
sum(ba1) td_amount,
|
|
|
sum(ba2) yd_amount,
|
|
|
- sum(ba3) byd_amount
|
|
|
+ sum(ba3) byd_amount,sum(d7) d7 ,sum(d30) d30
|
|
|
from dw_pitcher_trend where cost>0 and pitcher!='' {op1} {op2} {op3} group by pitcher {op4}
|
|
|
"""
|
|
|
|
|
|
- return getLimitData(db.dm, sql, page, page_size)
|
|
|
+ sum_sql=f"""select '总计' as pitcher,
|
|
|
+ sum(cost) cost,
|
|
|
+ sum(amount) amount,
|
|
|
+ sum(first_amount) first_amount,
|
|
|
+ round(sum(amount)/sum(cost),4) roi,
|
|
|
+ round(sum(first_amount)/sum(cost),4) first_roi,
|
|
|
+ round(sum(d7)/sum(cost),4) roi7,
|
|
|
+ round(sum(d30)/sum(cost),4) roi30,
|
|
|
+ sum(amount-cost) profit,
|
|
|
+ round(sum(click_count)/sum(view_count),4) click_rate,
|
|
|
+ round(sum(follow_user)/sum(click_count),4) follow_rate,
|
|
|
+ round(sum(order_user)/sum(click_count),4) order_rate,
|
|
|
+ round(sum(first_order_user)/sum(click_count),4) first_order_rate,
|
|
|
+ sum(view_count) view_count,
|
|
|
+ sum(click_count) click_count,
|
|
|
+ sum(follow_user) follow_user,
|
|
|
+ sum(order_user) order_user,
|
|
|
+ sum(first_order_user) first_order_user,
|
|
|
+ round(sum(cost)/sum(follow_user),2) follow_cost,
|
|
|
+ round(sum(cost)/sum(order_user),2) order_cost,
|
|
|
+ round(sum(cost)/sum(first_order_user),2) first_order_cost,
|
|
|
+ round(sum(amount)/sum(order_user),2) avg_amount,
|
|
|
+ sum(td_amount) td_amount,
|
|
|
+ sum(yd_amount) yd_amount,
|
|
|
+ sum(byd_amount) byd_amount from ({sql}) a
|
|
|
+"""
|
|
|
+
|
|
|
+ return getLimitSumDataV2(db.dm, sql,sum_sql, page, page_size)
|