|
@@ -529,7 +529,7 @@ concat(toString(a120),',',toString(r120/cost),',', toString(a120/cost),',',toStr
|
|
|
concat(toString(a150),',',toString(r150/cost),',', toString(a150/cost),',',toString(b150))
|
|
|
from
|
|
|
(
|
|
|
-select dt,book,cost,reg_order_amount,
|
|
|
+select pitcher,dt,book,cost,reg_order_amount,
|
|
|
if(cost=0,0,reg_order_amount/cost) roi,
|
|
|
follow_user new_follow_user,
|
|
|
if(follow_user=0,0,cost/follow_user) new_follow_per_cost,
|
|
@@ -668,6 +668,7 @@ r150-r120 a150,if(r1=0,0,r150/r1) b150
|
|
|
from order where channel='{channel}' and dt>='{start}' group by formatDateTime(reg_time,'%Y-%m-%d')
|
|
|
) b on a.dt=b.dt
|
|
|
"""
|
|
|
+ print(sql)
|
|
|
if start==end:
|
|
|
total=1
|
|
|
else:
|
|
@@ -707,6 +708,8 @@ from order where channel='{channel}' and dt>='{start}' group by formatDateTim
|
|
|
order_count+=i['order_count']
|
|
|
order_user_per_cost+=i['order_user_per_cost']
|
|
|
count= len(data)
|
|
|
+ if count==0:
|
|
|
+ return [],0
|
|
|
di={'cost':round(cost,2),'reg_amount':round(reg_amount,2),'roi':round(roi/count,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':'-'
|