|
@@ -449,9 +449,11 @@ def get_channel_order_trend(channel,pitcher,start,end,page,page_size,order_by,or
|
|
|
op5 = f" order by {order_by} {order}" if order_by and order else ''
|
|
|
|
|
|
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,
|
|
|
+ a.type,
|
|
|
node/100 require_roi,round(100/node,2) require_mult,
|
|
|
round(first_order_amount*100/node-cost,2) expect_profit,
|
|
|
+ annual_mult,
|
|
|
+ round(first_order_amount*annual_mult -cost,2) annual_expect_profit,
|
|
|
first_order_amount first_amount,
|
|
|
reg_order_amount reg_amount,
|
|
|
reg_order_amount-cost profit,
|
|
@@ -546,7 +548,8 @@ left join src_book_info c on a.dt=c.dt and a.book=c.book and a.type=c.type
|
|
|
round(sum(cost)/sum(order_user),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
|
|
|
+ round(sum(expect_profit),2) expect_profit,
|
|
|
+ round(sum(annual_expect_profit),2) annual_expect_profit
|
|
|
from ({sql}) a
|
|
|
"""
|
|
|
data,total,total_data=getLimitSumData(db.dm,sql,sumsql,page,page_size)
|
|
@@ -653,6 +656,7 @@ def get_pitcher_trend(pitcher,start=None,end=None,page=None,page_size=None,order
|
|
|
round(d30/cost,4) roi30,
|
|
|
reg_amount-cost profit,
|
|
|
inva_cost expect_profit,
|
|
|
+ annual_expect_profit,
|
|
|
CONCAT(d1,",",0,',',round(d1/cost,4)) d1,
|
|
|
CONCAT(d2-d1,",",round((d2-d1)/cost,4),',',round(d2/cost,4)) d2,
|
|
|
CONCAT(d3-d2,",",round((d3-d2)/cost,4),',',round(d3/cost,4)) d3,
|
|
@@ -695,7 +699,8 @@ def get_pitcher_trend(pitcher,start=None,end=None,page=None,page_size=None,order
|
|
|
round(sum(reg_amount7)/sum(cost),4) roi7,
|
|
|
sum(reg_amount30) reg_amount30,
|
|
|
round(sum(reg_amount30)/sum(cost),4) roi30,
|
|
|
- sum(expect_profit) expect_profit
|
|
|
+ sum(expect_profit) expect_profit,
|
|
|
+ sum(annual_expect_profit) annual_expect_profit
|
|
|
from ({sql}) a
|
|
|
"""
|
|
|
|