|
@@ -485,7 +485,12 @@ def get_channel_order_trend(channel,pitcher,start,end,page,page_size,order_by,or
|
|
|
else:
|
|
|
pitcher_op = f" and channel in {get_channels_from_user(pitcher)}"
|
|
|
|
|
|
- sql=f"""select stage,pitcher,channel,toString(dt) date,book,toDecimal32(cost,2),toDecimal32(reg_order_amount,2),roi,new_follow_user,new_follow_per_cost,order_user,order_count,
|
|
|
+ sql=f"""select stage,pitcher,channel,toString(dt) date,book,
|
|
|
+ toDecimal32(cost,2),
|
|
|
+ toDecimal32(reg_order_amount,2),
|
|
|
+ toDecimal32(reg_order_amount-cost,2),
|
|
|
+ roi,new_follow_user,
|
|
|
+ new_follow_per_cost,order_user,order_count,
|
|
|
toDecimal32(order_user_per_cost,2),
|
|
|
concat(toString(r1),',',toString(r1/cost),',', toString(a1/cost),',',toString(b1)),
|
|
|
concat(toString(a2),',',toString(r2/cost),',', toString(a2/cost),',',toString(b2)),
|
|
@@ -710,20 +715,21 @@ from order where dt>='{start}' {channel_op} group by formatDateTime(reg_time,'
|
|
|
|
|
|
for i in data:
|
|
|
for x,y in enumerate(i):
|
|
|
- if x>=13:
|
|
|
+ if x>=14:
|
|
|
i[x]=parse(y)
|
|
|
print(data)
|
|
|
- key=['stage','pitcher','channel','date','book','cost','reg_amount','roi','new_follow_user','new_follow_per_cost','order_user','order_count',
|
|
|
+ key=['stage','pitcher','channel','date','book','cost','reg_amount','profit','roi','new_follow_user','new_follow_per_cost','order_user','order_count',
|
|
|
'order_user_per_cost','d1','d2','d3','d4','d5','d6','d7','d8','d9','d10','d11','d12','d13','d14','d15','d16','d17','d18',
|
|
|
'd19','d20','d21','d22','d23','d24','d25','d26','d27','d28','d29','d30','d31','d32','d33','d34','d35','d36','d37','d38',
|
|
|
'd39','d40','d41','d42','d43','d44','d45','d46','d47','d48','d49','d50','d51','d52','d53','d54','d55','d56','d57','d58','d59',
|
|
|
'd60','m3','m4','m5']
|
|
|
data=get_dict_list(key,data)
|
|
|
|
|
|
- cost=reg_amount=roi=new_follow_user=new_follow_per_cost=order_user=order_count=order_user_per_cost=0
|
|
|
+ cost=reg_amount=roi=new_follow_user=new_follow_per_cost=order_user=order_count=order_user_per_cost=profit=0
|
|
|
for i in data:
|
|
|
cost+= i['cost']
|
|
|
reg_amount+=i['reg_amount']
|
|
|
+ profit+=i['profit']
|
|
|
roi+=i['roi']
|
|
|
new_follow_user+=i['new_follow_user']
|
|
|
new_follow_per_cost+=i['new_follow_per_cost']
|
|
@@ -733,13 +739,11 @@ from order where dt>='{start}' {channel_op} group by formatDateTime(reg_time,'
|
|
|
count= len(data)
|
|
|
if count==0:
|
|
|
return [],0
|
|
|
- total_data={'cost':round(cost,2),'reg_amount':round(reg_amount,2),'roi':round(reg_amount/cost,4), 'new_follow_user':new_follow_user,
|
|
|
+ total_data={'cost':round(cost,2),'reg_amount':round(reg_amount,2),'profit':round(profit,2),'roi':round(reg_amount/cost,4), 'new_follow_user':new_follow_user,
|
|
|
'new_follow_per_cost':round(new_follow_per_cost/count,2),'order_user':order_user,'order_count':order_count,
|
|
|
'order_user_per_cost':round(order_user_per_cost/count,2),'channel':'-','date':'总计','book':'-'
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
return data,total,total_data
|
|
|
|
|
|
def get_channel_summary(channel,pitcher,page,page_size,order_by,order,state,location,start,end):
|