|
@@ -448,12 +448,10 @@ def get_channel_order_trend(channel,pitcher,start,end,page,page_size,order_by,or
|
|
|
op4 = f" and dt<='{end}' " if end else ''
|
|
|
op5 = f" order by {order_by} {order}" if order_by and order else ''
|
|
|
|
|
|
- sql=f"""select stage,pitcher,a.channel,a.dt date,book,cost,
|
|
|
--- node/100 require_roi,round(100/node,2) require_mult,
|
|
|
--- round(first_order_amount*100/node-cost,2) expect_profit,
|
|
|
---
|
|
|
- 0 require_roi,0 require_mult,
|
|
|
- 0 expect_profit,
|
|
|
+ sql=f"""select stage,pitcher,a.channel,a.dt date,a.book,cost,
|
|
|
+ case a.type when 'qq' then 'gdt' when 'vx' then 'mp' end type,
|
|
|
+ node/100 require_roi,round(100/node,2) require_mult,
|
|
|
+ round(first_order_amount*100/node-cost,2) expect_profit,
|
|
|
first_order_amount first_amount,
|
|
|
reg_order_amount reg_amount,
|
|
|
reg_order_amount-cost profit,
|
|
@@ -529,7 +527,7 @@ concat(dm4-dm3 ,',' ,dm4/cost ,',', (dm4-dm3)/cost ,',' ,dm4/da1) m4,
|
|
|
concat(dm5-dm4 ,',' ,dm5/cost ,',', (dm5-dm4)/cost ,',' ,dm5/da1) m5
|
|
|
from ( select * from dw_channel where cost+reg_order_amount>0 {op1} {op2} {op3} {op4} ) a
|
|
|
left join dw_channel_amount_daily b on a.channel=b.channel and a.dt=b.dt
|
|
|
--- left join src_book_info c using(book,platform,type)
|
|
|
+left join src_book_info c on a.dt=c.dt and a.book=c.book and a.platform=c.platform and a.type=c.type
|
|
|
|
|
|
{op5}
|
|
|
"""
|
|
@@ -540,13 +538,15 @@ left join dw_channel_amount_daily b on a.channel=b.channel and a.dt=b.dt
|
|
|
sum(first_amount) first_amount,
|
|
|
sum(profit) profit,
|
|
|
sum(new_follow_user) new_follow_user,
|
|
|
- sum(reg_amount)/sum(cost) roi,
|
|
|
- sum(first_amount)/sum(cost) first_roi,
|
|
|
- sum(cost)/sum(new_follow_user) new_follow_per_cost,
|
|
|
+ round(sum(reg_amount)/sum(cost),4) roi,
|
|
|
+ round(sum(first_amount)/sum(cost),4) first_roi,
|
|
|
+ round(sum(cost)/sum(new_follow_user),2) new_follow_per_cost,
|
|
|
sum(order_user) order_user,
|
|
|
sum(order_count) order_count,
|
|
|
- sum(cost)/sum(order_count) order_user_per_cost,
|
|
|
- sum(expect_profit) expect_profit
|
|
|
+ round(sum(cost)/sum(order_count),2) order_user_per_cost,
|
|
|
+ round(avg(require_roi),4) require_roi,
|
|
|
+ round(avg(require_mult),2) require_mult,
|
|
|
+ round(sum(expect_profit),2) expect_profit
|
|
|
from ({sql}) a
|
|
|
"""
|
|
|
data,total,total_data=getLimitSumData(db.dm,sql,sumsql,page,page_size)
|