ck 4 سال پیش
والد
کامیت
fab2d432da
1فایلهای تغییر یافته به همراه4 افزوده شده و 4 حذف شده
  1. 4 4
      data_manage/pitcher_panel.py

+ 4 - 4
data_manage/pitcher_panel.py

@@ -336,7 +336,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 ''
     channels=''
-    channel=f" and channel='{channel}' "
+    channel_op=f" and channel='{channel}' "
     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),
@@ -386,7 +386,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 1=1 {channel}  and dt>='{start}' and dt<='{end}') a
+       from dw_daily_channel where 1=1 {channel_op}  and dt>='{start}' and dt<='{end}') a
 left outer join (
 
 select toDate(formatDateTime(reg_time,'%Y-%m-%d')) dt,
@@ -420,9 +420,9 @@ 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  1=1 {channel}  and dt>='{start}' group by formatDateTime(reg_time,'%Y-%m-%d')) b on a.dt=b.dt 
+       from order where  1=1 {channel_op}  and dt>='{start}' group by formatDateTime(reg_time,'%Y-%m-%d')) b on a.dt=b.dt 
 """
-
+    print(sql)
 
     total = ck.execute(f"select count(1) from ({sql}) a")[0][0]
     sql+=f" order by {order_by} {order} limit {(page-1)*page_size},{page_size} "