|
@@ -180,9 +180,9 @@ def get_channel_again_order_trend(channel,date,pitcher):
|
|
|
|
|
|
from dw_daily_channel where channel='{channel}' and dt='{date}'
|
|
|
"""
|
|
|
- # print(sql)
|
|
|
+ print(sql)
|
|
|
data=ck.execute(sql)
|
|
|
- # print(data)
|
|
|
+ print(data)
|
|
|
key1=['date','channel','book','cost','reg_amount','roi','new_follow','new_follow_per_cost',
|
|
|
'reg_count','reg_user','cost_per_user','avg_order_amount','avg_again_order_rate','order_count']
|
|
|
json1=get_dict_list(key1,get_round(data))[0]
|
|
@@ -191,7 +191,7 @@ def get_channel_again_order_trend(channel,date,pitcher):
|
|
|
1 as ddf,count(1) c1,sum(if(count>1,1,0)) c2,sum(if(count>2,1,0)) c3,
|
|
|
sum(if(count>3,1,0)) c4,sum(if(count>4,1,0)) c5,sum(if(count>5,1,0)) c6
|
|
|
from (select count(1) count
|
|
|
- from order where channel='观云书海' and date='{date}'
|
|
|
+ from order where channel='{channel}' and date='{date}'
|
|
|
and formatDateTime(reg_time,'%Y-%m-%d')='{date}' group by user_id,date) a
|
|
|
union all
|
|
|
select
|
|
@@ -199,7 +199,7 @@ select
|
|
|
sum(if(count>3,1,0)) c4,sum(if(count>4,1,0)) c5,sum(if(count>5,1,0)) c6
|
|
|
from (
|
|
|
select count(1) count
|
|
|
- from order where channel='观云书海' and date>='{date}' and date<=addDays(toDate('{date}'),1)
|
|
|
+ from order where channel='{channel}' and date>='{date}' and date<=addDays(toDate('{date}'),1)
|
|
|
and formatDateTime(reg_time,'%Y-%m-%d')='{date}' group by user_id) a
|
|
|
union all
|
|
|
select
|
|
@@ -207,7 +207,7 @@ select
|
|
|
sum(if(count>3,1,0)) c4,sum(if(count>4,1,0)) c5,sum(if(count>5,1,0)) c6
|
|
|
from (
|
|
|
select count(1) count
|
|
|
- from order where channel='观云书海' and date>='{date}' and date<=addDays(toDate('{date}'),2)
|
|
|
+ from order where channel='{channel}' and date>='{date}' and date<=addDays(toDate('{date}'),2)
|
|
|
and formatDateTime(reg_time,'%Y-%m-%d')='{date}' group by user_id) a
|
|
|
union all
|
|
|
select
|
|
@@ -215,7 +215,7 @@ select
|
|
|
sum(if(count>3,1,0)) c4,sum(if(count>4,1,0)) c5,sum(if(count>5,1,0)) c6
|
|
|
from (
|
|
|
select count(1) count
|
|
|
- from order where channel='观云书海' and date>='{date}' and date<=addDays(toDate('{date}'),3)
|
|
|
+ from order where channel='{channel}' and date>='{date}' and date<=addDays(toDate('{date}'),3)
|
|
|
and formatDateTime(reg_time,'%Y-%m-%d')='{date}' group by user_id) a
|
|
|
union all
|
|
|
select
|
|
@@ -223,7 +223,7 @@ select
|
|
|
sum(if(count>3,1,0)) c4,sum(if(count>4,1,0)) c5,sum(if(count>5,1,0)) c6
|
|
|
from (
|
|
|
select count(1) count
|
|
|
- from order where channel='观云书海' and date>='{date}' and date<=addDays(toDate('{date}'),4)
|
|
|
+ from order where channel='{channel}' and date>='{date}' and date<=addDays(toDate('{date}'),4)
|
|
|
and formatDateTime(reg_time,'%Y-%m-%d')='{date}' group by user_id) a
|
|
|
union all
|
|
|
select
|
|
@@ -231,7 +231,7 @@ select
|
|
|
sum(if(count>3,1,0)) c4,sum(if(count>4,1,0)) c5,sum(if(count>5,1,0)) c6
|
|
|
from (
|
|
|
select count(1) count
|
|
|
- from order where channel='观云书海' and date>='{date}' and date<=addDays(toDate('{date}'),5)
|
|
|
+ from order where channel='{channel}' and date>='{date}' and date<=addDays(toDate('{date}'),5)
|
|
|
and formatDateTime(reg_time,'%Y-%m-%d')='{date}' group by user_id) a
|
|
|
union all
|
|
|
select
|
|
@@ -239,7 +239,7 @@ select
|
|
|
sum(if(count>3,1,0)) c4,sum(if(count>4,1,0)) c5,sum(if(count>5,1,0)) c6
|
|
|
from (
|
|
|
select count(1) count
|
|
|
- from order where channel='观云书海' and date>='{date}' and date<=addDays(toDate('{date}'),6)
|
|
|
+ from order where channel='{channel}' and date>='{date}' and date<=addDays(toDate('{date}'),6)
|
|
|
and formatDateTime(reg_time,'%Y-%m-%d')='{date}' group by user_id) a"""
|
|
|
|
|
|
df=ck.execute(sql2)
|