|
@@ -465,7 +465,7 @@ select toDate(formatDateTime(reg_time,'%Y-%m-%d')) dt,
|
|
|
|
|
|
def get_channel_order_trend(channel,pitcher,start,end,page,page_size,order_by,order):
|
|
|
# channels = f' and channel in {get_channels_from_user(pitcher)} ' if pitcher != '赞象 admin' else ''
|
|
|
-
|
|
|
+ channel_op =f" and channel='{channel}' "
|
|
|
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)),
|
|
@@ -539,7 +539,7 @@ select pitcher,dt,book,cost,reg_order_amount,
|
|
|
if(follow_user=0,0,cost/follow_user) new_follow_per_cost,
|
|
|
reg_order_user order_user, reg_order_count order_count,
|
|
|
if(reg_order_user=0,0,cost/reg_order_user) order_user_per_cost
|
|
|
- from dw_daily_channel where dt>='{start}' and dt<='{end}' and channel='{channel}' and cost>0) a
|
|
|
+ from dw_daily_channel where dt>='{start}' and dt<='{end}' {channel_op} and cost>0) a
|
|
|
|
|
|
left outer join (
|
|
|
select toDate(formatDateTime(reg_time,'%Y-%m-%d')) dt,
|
|
@@ -669,7 +669,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 channel='{channel}' and dt>='{start}' group by formatDateTime(reg_time,'%Y-%m-%d')
|
|
|
+from order where and dt>='{start}' {channel_op} group by formatDateTime(reg_time,'%Y-%m-%d')
|
|
|
) b on a.dt=b.dt
|
|
|
"""
|
|
|
print(sql)
|