|
@@ -1346,6 +1346,18 @@ def get_pitcher_trend(pitcher, start=None, end=None, page=None, page_size=None,
|
|
|
|
|
|
sql = f"""select dt,pitcher,
|
|
|
reg_num,create_user_num,
|
|
|
+ first_order_user, -- 新增付费人数
|
|
|
+ round(cost/first_order_user,2) first_order_cost, -- 新增付费成本
|
|
|
+ round(cost/reg_num,2) create_user_per_cost, -- 新注册用户平均付费
|
|
|
+ round(first_order_amount/first_order_user,2) ARPU, -- 新增付费ARPU
|
|
|
+ round(first_order_user/reg_num,4) first_order_rate, -- 新增付费率
|
|
|
+ round(reg_amount/reg_order_user,2) order_ARPU, -- 付费ARPU
|
|
|
+ hundred_user_num, -- 单日付费100+用户数
|
|
|
+ round(cost/hundred_user_num,2) hundred_user_num_cost , -- 单日付费100+用户付费成本
|
|
|
+ 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 , -- 至今付费单价
|
|
|
cost,
|
|
|
reg_amount,
|
|
|
d1 first_amount,
|
|
@@ -1358,36 +1370,36 @@ def get_pitcher_trend(pitcher, start=None, end=None, page=None, page_size=None,
|
|
|
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,
|
|
|
- CONCAT(d4-d3,",",round((d4-d3)/cost,4),',',round(d4/cost,4)) d4,
|
|
|
- CONCAT(d5-d4,",",round((d5-d4)/cost,4),',',round(d5/cost,4)) d5,
|
|
|
- CONCAT(d6-d5,",",round((d6-d5)/cost,4),',',round(d6/cost,4)) d6,
|
|
|
- CONCAT(d7-d6,",",round((d7-d6)/cost,4),',',round(d7/cost,4)) d7,
|
|
|
- CONCAT(d8-d7,",",round((d8-d7)/cost,4),',',round(d8/cost,4)) d8,
|
|
|
- CONCAT(d9-d8,",",round((d9-d8)/cost,4),',',round(d9/cost,4)) d9,
|
|
|
- CONCAT(d10-d9,",",round((d10-d9)/cost,4),',',round(d10/cost,4)) d10,
|
|
|
- CONCAT(d11-d10,",",round((d11-d10)/cost,4),',',round(d11/cost,4)) d11,
|
|
|
- CONCAT(d12-d11,",",round((d12-d11)/cost,4),',',round(d12/cost,4)) d12,
|
|
|
- CONCAT(d13-d12,",",round((d13-d12)/cost,4),',',round(d13/cost,4)) d13,
|
|
|
- CONCAT(d14-d13,",",round((d14-d13)/cost,4),',',round(d14/cost,4)) d14,
|
|
|
- CONCAT(d15-d14,",",round((d15-d14)/cost,4),',',round(d15/cost,4)) d15,
|
|
|
- CONCAT(d16-d15,",",round((d16-d15)/cost,4),',',round(d16/cost,4)) d16,
|
|
|
- CONCAT(d17-d16,",",round((d17-d16)/cost,4),',',round(d17/cost,4)) d17,
|
|
|
- CONCAT(d18-d17,",",round((d18-d17)/cost,4),',',round(d18/cost,4)) d18,
|
|
|
- CONCAT(d19-d18,",",round((d19-d18)/cost,4),',',round(d19/cost,4)) d19,
|
|
|
- CONCAT(d20-d19,",",round((d20-d19)/cost,4),',',round(d20/cost,4)) d20,
|
|
|
- CONCAT(d21-d20,",",round((d21-d20)/cost,4),',',round(d21/cost,4)) d21,
|
|
|
- CONCAT(d22-d21,",",round((d22-d21)/cost,4),',',round(d22/cost,4)) d22,
|
|
|
- CONCAT(d23-d22,",",round((d23-d22)/cost,4),',',round(d23/cost,4)) d23,
|
|
|
- CONCAT(d24-d23,",",round((d24-d23)/cost,4),',',round(d24/cost,4)) d24,
|
|
|
- CONCAT(d25-d24,",",round((d25-d24)/cost,4),',',round(d25/cost,4)) d25,
|
|
|
- CONCAT(d26-d25,",",round((d26-d25)/cost,4),',',round(d26/cost,4)) d26,
|
|
|
- CONCAT(d27-d26,",",round((d27-d26)/cost,4),',',round(d27/cost,4)) d27,
|
|
|
- CONCAT(d28-d27,",",round((d28-d27)/cost,4),',',round(d28/cost,4)) d28,
|
|
|
- CONCAT(d29-d28,",",round((d29-d28)/cost,4),',',round(d29/cost,4)) d29,
|
|
|
- CONCAT(d30-d29,",",round((d30-d29)/cost,4),',',round(d30/cost,4)) d30,
|
|
|
+ CONCAT(d1,",",0,',',round(d1/cost,4),',',1) d1,
|
|
|
+ CONCAT(d2-d1,",",round((d2-d1)/cost,4),',',round(d2/cost,4),',',d2/d1) d2,
|
|
|
+ CONCAT(d3-d2,",",round((d3-d2)/cost,4),',',round(d3/cost,4),',',d3/d1) d3,
|
|
|
+ CONCAT(d4-d3,",",round((d4-d3)/cost,4),',',round(d4/cost,4),',',d4/d1) d4,
|
|
|
+ CONCAT(d5-d4,",",round((d5-d4)/cost,4),',',round(d5/cost,4),',',d5/d1) d5,
|
|
|
+ CONCAT(d6-d5,",",round((d6-d5)/cost,4),',',round(d6/cost,4),',',d6/d1) d6,
|
|
|
+ CONCAT(d7-d6,",",round((d7-d6)/cost,4),',',round(d7/cost,4),',',d7/d1) d7,
|
|
|
+ CONCAT(d8-d7,",",round((d8-d7)/cost,4),',',round(d8/cost,4),',',d8/d1) d8,
|
|
|
+ CONCAT(d9-d8,",",round((d9-d8)/cost,4),',',round(d9/cost,4),',',d9/d1) d9,
|
|
|
+ CONCAT(d10-d9,",",round((d10-d9)/cost,4),',',round(d10/cost,4),',',d10/d1) d10,
|
|
|
+ CONCAT(d11-d10,",",round((d11-d10)/cost,4),',',round(d11/cost,4),',',d11/d1) d11,
|
|
|
+ CONCAT(d12-d11,",",round((d12-d11)/cost,4),',',round(d12/cost,4),',',d12/d1) d12,
|
|
|
+ CONCAT(d13-d12,",",round((d13-d12)/cost,4),',',round(d13/cost,4),',',d13/d1) d13,
|
|
|
+ CONCAT(d14-d13,",",round((d14-d13)/cost,4),',',round(d14/cost,4),',',d14/d1) d14,
|
|
|
+ CONCAT(d15-d14,",",round((d15-d14)/cost,4),',',round(d15/cost,4),',',d15/d1) d15,
|
|
|
+ CONCAT(d16-d15,",",round((d16-d15)/cost,4),',',round(d16/cost,4),',',d16/d1) d16,
|
|
|
+ CONCAT(d17-d16,",",round((d17-d16)/cost,4),',',round(d17/cost,4),',',d17/d1) d17,
|
|
|
+ CONCAT(d18-d17,",",round((d18-d17)/cost,4),',',round(d18/cost,4),',',d18/d1) d18,
|
|
|
+ CONCAT(d19-d18,",",round((d19-d18)/cost,4),',',round(d19/cost,4),',',d19/d1) d19,
|
|
|
+ CONCAT(d20-d19,",",round((d20-d19)/cost,4),',',round(d20/cost,4),',',d20/d1) d20,
|
|
|
+ CONCAT(d21-d20,",",round((d21-d20)/cost,4),',',round(d21/cost,4),',',d21/d1) d21,
|
|
|
+ CONCAT(d22-d21,",",round((d22-d21)/cost,4),',',round(d22/cost,4),',',d22/d1) d22,
|
|
|
+ CONCAT(d23-d22,",",round((d23-d22)/cost,4),',',round(d23/cost,4),',',d23/d1) d23,
|
|
|
+ CONCAT(d24-d23,",",round((d24-d23)/cost,4),',',round(d24/cost,4),',',d24/d1) d24,
|
|
|
+ CONCAT(d25-d24,",",round((d25-d24)/cost,4),',',round(d25/cost,4),',',d25/d1) d25,
|
|
|
+ CONCAT(d26-d25,",",round((d26-d25)/cost,4),',',round(d26/cost,4),',',d26/d1) d26,
|
|
|
+ CONCAT(d27-d26,",",round((d27-d26)/cost,4),',',round(d27/cost,4),',',d27/d1) d27,
|
|
|
+ CONCAT(d28-d27,",",round((d28-d27)/cost,4),',',round(d28/cost,4),',',d28/d1) d28,
|
|
|
+ CONCAT(d29-d28,",",round((d29-d28)/cost,4),',',round(d29/cost,4),',',d29/d1) d29,
|
|
|
+ CONCAT(d30-d29,",",round((d30-d29)/cost,4),',',round(d30/cost,4),',',d30/d1) d30,
|
|
|
d1 as da1,d2 as da2,d3 as da3,d4 as da4,d5 as da5,d6 as da6,d7 as da7,d8 as da8,d9 as da9,d10 as da10,
|
|
|
d11 as da11,d12 as da12,d13 as da13,d14 as da14,d15 as da15,d16 as da16,d17 as da17,d18 as da18,d19 as da19,
|
|
|
d20 as da20,d21 as da21,d22 as da22,d23 as da23,d24 as da24,d25 as da25,d26 as da26,d27 as da27,d28 as da28,
|
|
@@ -1400,6 +1412,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_rate,4)) first_order_rate, -- 新增付费率
|
|
|
+ sum(order_ARPU) order_ARPU, -- 付费ARPU
|
|
|
+ sum(hundred_user_num) hundred_user_num, -- 单日付费100+用户数
|
|
|
+ sum(hundred_user_num_cost) 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, -- 至今付费单价
|
|
|
round(sum(first_amount)/sum(cost),4) first_roi,
|
|
|
round(sum(reg_amount)/sum(cost),4) roi,
|
|
|
sum(profit) profit,
|
|
@@ -1454,10 +1478,11 @@ def get_pitcher_trend(pitcher, start=None, end=None, page=None, page_size=None,
|
|
|
li[0] = round(float(li[0]), 2)
|
|
|
li[1] = round(float(li[1]), 4)
|
|
|
li[2] = round(float(li[2]), 4)
|
|
|
+ li[3] = round(float(li[3]), 2)
|
|
|
if is_total:
|
|
|
- return dict(zip(['amount', 'roi', 'add'], li))
|
|
|
+ return dict(zip(['amount', 'roi', 'add', 'mult'], li))
|
|
|
else:
|
|
|
- return dict(zip(['amount', 'add', 'roi'], li))
|
|
|
+ return dict(zip(['amount', 'add', 'roi', 'mult'], li))
|
|
|
|
|
|
for k, v in total_data.items():
|
|
|
if k in ['d1', 'd2', 'd3', 'd4', 'd5', 'd6', 'd7', 'd8', 'd9', 'd10',
|