|
@@ -129,16 +129,19 @@ def get_channel_overview(user_id, channel, pitcher, stage, book,agent_id, start,
|
|
|
op = f" and channel in {str(UserAuthUtils.get_auth_channel(user_id))}"
|
|
|
op1 = f" and pitcher ='{pitcher}' " if pitcher else ''
|
|
|
op2 = f" and channel='{channel}'" if channel else ''
|
|
|
- op3 = f" and dt>='{start}' " if start else ''
|
|
|
- op4 = f" and dt<='{end}' " if end else ''
|
|
|
+ op3 = f" and a.dt>='{start}' " if start else ''
|
|
|
+ op4 = f" and a.dt<='{end}' " if end else ''
|
|
|
op5 = f" order by {order_by} {order}" if order_by and order else ''
|
|
|
op6 = f" and stage='{stage}'" if stage else ''
|
|
|
op7 = f" and book='{book}'" if book else ''
|
|
|
op8 = f" and agent_id = '{agent_id}'" if agent_id else ''
|
|
|
|
|
|
- sql = f"""select channel,dt date,agent_name,reg_num,
|
|
|
+ sql = f"""select a.channel,a.dt date,agent_name,reg_num,
|
|
|
round(if(reg_num=0,0,cost/reg_num),2) reg_per_cost,
|
|
|
create_user_num,
|
|
|
+ hundred_user_num, -- 单日付费100+用户数
|
|
|
+ round(cost/hundred_user_num,2) hundred_user_num_cost , -- 单日付费100+用户付费成本
|
|
|
+ round(da7/cost,4) roi7, -- 最近7日首日ROI
|
|
|
round(if(create_user_num=0,0,cost/create_user_num),2) create_user_per_cost,
|
|
|
view_count,click_count,
|
|
|
round(if(view_count=0,0,click_count/view_count),4) click_rate,
|
|
@@ -177,12 +180,17 @@ def get_channel_overview(user_id, channel, pitcher, stage, book,agent_id, start,
|
|
|
round(reg_order_amount/reg_order_user,2) user_per_amount,
|
|
|
round(follow_user/click_count,4) click_follow_rate,
|
|
|
round(reg_order_user/follow_user,4) follow_order_rate
|
|
|
-from dw_channel where 1=1 {op} {op1} {op2} {op3} {op4} {op6} {op7} {op8} {op5} """
|
|
|
+from dw_channel a
|
|
|
+left join dw_channel_amount_daily b on a.dt=b.dt and a.channel=b.channel
|
|
|
+ where 1=1 {op} {op1} {op2} {op3} {op4} {op6} {op7} {op8} {op5} """
|
|
|
|
|
|
sumsql = f"""select '总计' date,
|
|
|
sum(reg_num) reg_num,
|
|
|
|
|
|
max(game_user_sum) game_user_sum,
|
|
|
+ sum(hundred_user_num) hundred_user_num, -- 单日付费100+用户数
|
|
|
+ sum(round(hundred_user_num_cost,2)) hundred_user_num_cost, -- 单日付费100+用户付费成本
|
|
|
+ sum(round(roi7,4)) roi7, -- 最近7日首日ROI
|
|
|
round(if(sum(reg_num)=0,0,sum(reg_num*sixty_stay_rate)/sum(reg_num)),2) sixty_stay_rate,
|
|
|
round(if(sum(reg_num)=0,0,sum(reg_num*fortyfive_stay_rate)/sum(reg_num)),2) fortyfive_stay_rate,
|
|
|
round(if(sum(reg_num)=0,0,sum(reg_num*thirty_stay_rate)/sum(reg_num)),2) thirty_stay_rate,
|
|
@@ -1371,7 +1379,7 @@ def get_pitcher_trend(pitcher, start=None, end=None, page=None, page_size=None,
|
|
|
reg_order_user , -- 至今付费人数
|
|
|
reg_order_count, -- 至今付费次数
|
|
|
round(cost/create_user_num,2) create_user_num_cost, -- 新增创角单价
|
|
|
- round(cost/reg_order_user) reg_order_user_cost , -- 至今付费单价
|
|
|
+ round(cost/reg_order_user,2) reg_order_user_cost , -- 至今付费单价
|
|
|
cost,
|
|
|
reg_amount,
|
|
|
d1 first_amount,
|
|
@@ -1426,18 +1434,18 @@ def get_pitcher_trend(pitcher, start=None, end=None, page=None, page_size=None,
|
|
|
sum(reg_num) reg_num,
|
|
|
sum(create_user_num) create_user_num,
|
|
|
sum(reg_amount) reg_amount,
|
|
|
- sum(first_order_user) first_order_user, -- 新增付费人数
|
|
|
- sum(first_order_cost) first_order_cost, -- 新增付费成本
|
|
|
- sum(create_user_per_cost) create_user_per_cost, -- 新注册用户平均付费
|
|
|
- sum(ARPU) ARPU, -- 新增付费ARPU
|
|
|
+ sum(round(first_order_user,2)) first_order_user, -- 新增付费人数
|
|
|
+ sum(round(first_order_cost,2)) first_order_cost, -- 新增付费成本
|
|
|
+ sum(round(create_user_per_cost,2)) create_user_per_cost, -- 新注册用户平均付费
|
|
|
+ sum(round(ARPU,2)) ARPU, -- 新增付费ARPU
|
|
|
sum(round(first_order_rate,4)) first_order_rate, -- 新增付费率
|
|
|
- sum(order_ARPU) order_ARPU, -- 付费ARPU
|
|
|
+ sum(round(order_ARPU,2)) order_ARPU, -- 付费ARPU
|
|
|
sum(hundred_user_num) hundred_user_num, -- 单日付费100+用户数
|
|
|
- sum(hundred_user_num_cost) hundred_user_num_cost, -- 单日付费100+用户付费成本
|
|
|
+ sum(round(hundred_user_num_cost,2)) hundred_user_num_cost, -- 单日付费100+用户付费成本
|
|
|
sum(reg_order_user) reg_order_user, -- 至今付费人数
|
|
|
sum(reg_order_count) reg_order_count, -- 至今付费次数
|
|
|
- sum(create_user_num_cost) create_user_num_cost, -- 新增创角单价
|
|
|
- sum(reg_order_user_cost) reg_order_user_cost, -- 至今付费单价
|
|
|
+ sum(round(create_user_num_cost,2)) create_user_num_cost, -- 新增创角单价
|
|
|
+ sum(round(reg_order_user_cost,2)) reg_order_user_cost, -- 至今付费单价
|
|
|
round(sum(first_amount)/sum(cost),4) first_roi,
|
|
|
round(sum(reg_amount)/sum(cost),4) roi,
|
|
|
sum(profit) profit,
|