|
@@ -189,13 +189,21 @@ a.ct as a_ct,b.ct as b_ct,c.ct as c_ct,d.ct as d_ct,e.ct as e_ct,
|
|
|
seven.ct as seven_ct,fifteen.ct as fifteen_ct,thirty.ct as thirty_ct,
|
|
|
fortyfive.ct as fortyfive_ct,sixty.ct as sixty_ct
|
|
|
from
|
|
|
+(select a.name as name,d.app_id as app_id ,d.agent_id as agent_id
|
|
|
+ from quchen_text.advertiser_vx a
|
|
|
+ left join db_mp.h_game b on a.book = b.name
|
|
|
+ left join db_mp.mp_mp_conf c on a.name= c.wx_name
|
|
|
+ left join db_mp.mp_conf_agent d on c.id=d.advertiser_conf_id
|
|
|
+where d.app_id =b.id
|
|
|
+group by d.app_id ,d.agent_id) h
|
|
|
+left join
|
|
|
(select '{ymd}',a.app_id,a.agent_id,count(*) as ct from
|
|
|
db_mp.h_member a
|
|
|
left join (select distinct(mem_id) from db_mp.{table_name_login_today}
|
|
|
where date = '{ymd}' ) b on a.id=b.mem_id
|
|
|
where a.create_time >={timestamp_ymd} and a.create_time <={timestamp_tom}
|
|
|
and b.mem_id is not null
|
|
|
-group by a.app_id ,a.agent_id ) a
|
|
|
+group by a.app_id ,a.agent_id ) a on a.app_id = h.app_id and a.agent_id = h.agent_id
|
|
|
left join
|
|
|
(select '{ymd}',a.app_id,a.agent_id,count(*) as ct from
|
|
|
db_mp.h_member a
|
|
@@ -203,7 +211,7 @@ left join (select distinct(mem_id) from db_mp.{table_name_login_tom}
|
|
|
where date = '{ymd_tom}' ) b on a.id=b.mem_id
|
|
|
where a.create_time >={timestamp_ymd} and a.create_time <={timestamp_tom}
|
|
|
and b.mem_id is not null
|
|
|
-group by a.app_id ,a.agent_id ) b on a.app_id =b.app_id and a.agent_id =b.agent_id
|
|
|
+group by a.app_id ,a.agent_id ) b on h.app_id =b.app_id and h.agent_id =b.agent_id
|
|
|
left join
|
|
|
(select '{ymd}',a.app_id,a.agent_id,count(*) as ct from
|
|
|
db_mp.h_member a
|
|
@@ -211,7 +219,7 @@ left join (select distinct(mem_id) from db_mp.{table_name_login_tom_after}
|
|
|
where date = '{ymd_tom_after}' ) b on a.id=b.mem_id
|
|
|
where a.create_time >={timestamp_ymd} and a.create_time <={timestamp_tom}
|
|
|
and b.mem_id is not null
|
|
|
-group by a.app_id ,a.agent_id ) c on a.app_id =c.app_id and a.agent_id = c.agent_id
|
|
|
+group by a.app_id ,a.agent_id ) c on h.app_id =c.app_id and h.agent_id = c.agent_id
|
|
|
left join
|
|
|
(select '{ymd}',a.app_id,a.agent_id,count(*) as ct from
|
|
|
db_mp.h_member a
|
|
@@ -219,7 +227,7 @@ left join (select distinct(mem_id) from db_mp.{table_name_login_seven_day}
|
|
|
where date = '{ymd_seven_day}' ) b on a.id=b.mem_id
|
|
|
where a.create_time >={timestamp_ymd} and a.create_time <={timestamp_tom}
|
|
|
and b.mem_id is not null
|
|
|
-group by a.app_id ,a.agent_id ) seven on a.app_id =seven.app_id and a.agent_id = seven.agent_id
|
|
|
+group by a.app_id ,a.agent_id ) seven on h.app_id =seven.app_id and h.agent_id = seven.agent_id
|
|
|
left join
|
|
|
(select '{ymd}',a.app_id,a.agent_id,count(*) as ct from
|
|
|
db_mp.h_member a
|
|
@@ -227,7 +235,7 @@ left join (select distinct(mem_id) from db_mp.{table_name_login_fifteen_day}
|
|
|
where date = '{ymd_fifteen_day}' ) b on a.id=b.mem_id
|
|
|
where a.create_time >={timestamp_ymd} and a.create_time <={timestamp_tom}
|
|
|
and b.mem_id is not null
|
|
|
-group by a.app_id ,a.agent_id ) fifteen on a.app_id =fifteen.app_id and a.agent_id = fifteen.agent_id
|
|
|
+group by a.app_id ,a.agent_id ) fifteen on h.app_id =fifteen.app_id and h.agent_id = fifteen.agent_id
|
|
|
left join
|
|
|
(select '{ymd}',a.app_id,a.agent_id,count(*) as ct from
|
|
|
db_mp.h_member a
|
|
@@ -235,7 +243,7 @@ left join (select distinct(mem_id) from db_mp.{table_name_login_thirty_day}
|
|
|
where date = '{ymd_thirty_day}' ) b on a.id=b.mem_id
|
|
|
where a.create_time >={timestamp_ymd} and a.create_time <={timestamp_tom}
|
|
|
and b.mem_id is not null
|
|
|
-group by a.app_id ,a.agent_id ) thirty on a.app_id =thirty.app_id and a.agent_id = thirty.agent_id
|
|
|
+group by a.app_id ,a.agent_id ) thirty on h.app_id =thirty.app_id and h.agent_id = thirty.agent_id
|
|
|
left join
|
|
|
(select '{ymd}',a.app_id,a.agent_id,count(*) as ct from
|
|
|
db_mp.h_member a
|
|
@@ -243,7 +251,7 @@ left join (select distinct(mem_id) from db_mp.{table_name_login_fortyfive_day}
|
|
|
where date = '{ymd_fortyfive_day}' ) b on a.id=b.mem_id
|
|
|
where a.create_time >={timestamp_ymd} and a.create_time <={timestamp_tom}
|
|
|
and b.mem_id is not null
|
|
|
-group by a.app_id ,a.agent_id ) fortyfive on a.app_id =fortyfive.app_id and a.agent_id = fortyfive.agent_id
|
|
|
+group by a.app_id ,a.agent_id ) fortyfive on h.app_id =fortyfive.app_id and h.agent_id = fortyfive.agent_id
|
|
|
left join
|
|
|
(select '{ymd}',a.app_id,a.agent_id,count(*) as ct from
|
|
|
db_mp.h_member a
|
|
@@ -251,24 +259,16 @@ left join (select distinct(mem_id) from db_mp.{table_name_login_sixty_day}
|
|
|
where date = '{ymd_sixty_day}' ) b on a.id=b.mem_id
|
|
|
where a.create_time >={timestamp_ymd} and a.create_time <={timestamp_tom}
|
|
|
and b.mem_id is not null
|
|
|
-group by a.app_id ,a.agent_id ) sixty on a.app_id =sixty.app_id and a.agent_id = sixty.agent_id
|
|
|
+group by a.app_id ,a.agent_id ) sixty on h.app_id =sixty.app_id and h.agent_id = sixty.agent_id
|
|
|
left join
|
|
|
(select app_id ,count(*) as ct from db_mp.h_member hm
|
|
|
where create_time <={timestamp_tom}
|
|
|
-group by app_id ) d on a.app_id =d.app_id
|
|
|
+group by app_id ) d on h.app_id =d.app_id
|
|
|
left join
|
|
|
(select count(distinct(mem_id)) as ct,app_id from db_mp.{table_name_login_today}
|
|
|
where date = '{ymd}'
|
|
|
- group by app_id ) e on a.app_id =e.app_id
|
|
|
-left join
|
|
|
-(select a.name as name,d.app_id as app_id ,d.agent_id as agent_id
|
|
|
- from quchen_text.advertiser_vx a
|
|
|
- left join db_mp.h_game b on a.book = b.name
|
|
|
- left join db_mp.mp_mp_conf c on a.name= c.wx_name
|
|
|
- left join db_mp.mp_conf_agent d on c.id=d.advertiser_conf_id
|
|
|
-where d.app_id =b.id
|
|
|
-group by d.app_id ,d.agent_id) h on a.app_id = h.app_id and a.agent_id = h.agent_id
|
|
|
-where h.name is not null) as keep_data
|
|
|
+ group by app_id ) e on h.app_id =e.app_id
|
|
|
+) as keep_data
|
|
|
group by channel)
|
|
|
v on x.channel= v.channel
|
|
|
|
|
@@ -422,10 +422,10 @@ def order_account_text():
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
# channel_info_daily('2021-02-06')
|
|
|
- # dw_daily_channel_cost('2021-10-11')
|
|
|
+ # dw_daily_channel_cost('2021-09-19')
|
|
|
# exit()
|
|
|
# channel_by_account_daily('2021-02-05')
|
|
|
- for i in dt.getDateLists('2021-09-08', '2021-11-13'):
|
|
|
+ for i in dt.getDateLists('2021-09-08', '2021-09-30'):
|
|
|
print(i)
|
|
|
channel_by_account_daily(i)
|
|
|
channel_info_daily(i)
|