|
@@ -465,7 +465,8 @@ select toDate(formatDateTime(reg_time,'%Y-%m-%d')) dt,
|
|
|
|
|
|
def get_channel_order_trend(channel,pitcher,start,end,page,page_size,order_by,order):
|
|
|
|
|
|
- channel_op =f" and channel='{channel}' "
|
|
|
+
|
|
|
+ channel_op =f" and channel='{channel}' " if channel!='' else ''
|
|
|
sql=f"""select pitcher,'{channel}' 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,
|
|
|
toDecimal32(order_user_per_cost,2),
|
|
|
concat(toString(r1),',',toString(r1/cost),',', toString(a1/cost),',',toString(b1)),
|
|
@@ -669,7 +670,7 @@ r60-r59 a60,if(r1=0,0,r60/r1) b60,
|
|
|
r90-r60 a90,if(r1=0,0,r90/r1) b90,
|
|
|
r120-r90 a120,if(r1=0,0,r120/r1) b120,
|
|
|
r150-r120 a150,if(r1=0,0,r150/r1) b150
|
|
|
-from order where and dt>='{start}' {channel_op} group by formatDateTime(reg_time,'%Y-%m-%d')
|
|
|
+from order where dt>='{start}' {channel_op} group by formatDateTime(reg_time,'%Y-%m-%d')
|
|
|
) b on a.dt=b.dt
|
|
|
"""
|
|
|
print(sql)
|