|
@@ -334,7 +334,7 @@ select
|
|
|
|
|
|
def get_channel_active(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=f" and channel='{channel}' " if channel!='' else ''
|
|
|
sql=f"""select formatDateTime(a.dt,'%Y-%m-%d') date, '{channel}' channel,book,toDecimal32(cost,2),toDecimal32(reg_amount,2),roi,new_follow_user,toDecimal32(new_follow_per_cost,2),order_user,order_count,
|
|
|
toDecimal32(order_user_per_cost,2),day7_avg_act_rate,toDecimal32(day7_avg_act_per_cost,2),day30_avg_act_rate,toDecimal32(ay30_avg_act_cost,2),
|
|
|
toDecimal32(act_per_cost,2),
|
|
@@ -384,7 +384,7 @@ select dt,book,cost,
|
|
|
if(follow_user=0,0,reg_order_user30/follow_user) day30_avg_act_rate,
|
|
|
if(reg_order_user30=0,0,cost/reg_order_user30) ay30_avg_act_cost,
|
|
|
if(reg_order_user=0,0,cost/reg_order_user) act_per_cost
|
|
|
- from dw_daily_channel where channel='{channel}' {channels} and dt>='{start}' and dt<='{end}') a
|
|
|
+ from dw_daily_channel where 1=1 {channel} {channels} and dt>='{start}' and dt<='{end}') a
|
|
|
left outer join (
|
|
|
|
|
|
select toDate(formatDateTime(reg_time,'%Y-%m-%d')) dt,
|
|
@@ -418,7 +418,7 @@ select toDate(formatDateTime(reg_time,'%Y-%m-%d')) dt,
|
|
|
count(distinct if(addDays(toDate(formatDateTime(reg_time,'%Y-%m-%d')),27)>=date,user_id,NULL)) reg_order_user28,
|
|
|
count(distinct if(addDays(toDate(formatDateTime(reg_time,'%Y-%m-%d')),28)>=date,user_id,NULL)) reg_order_user29,
|
|
|
count(distinct if(addDays(toDate(formatDateTime(reg_time,'%Y-%m-%d')),29)>=date,user_id,NULL)) reg_order_user30
|
|
|
- from order where channel='{channel}' and dt>='{start}' group by formatDateTime(reg_time,'%Y-%m-%d')) b on a.dt=b.dt
|
|
|
+ from order where {channel} {channels} and dt>='{start}' group by formatDateTime(reg_time,'%Y-%m-%d')) b on a.dt=b.dt
|
|
|
"""
|
|
|
|
|
|
total = ck.execute(f"select count(1) from ({sql}) a")[0][0]
|