|
@@ -46,12 +46,15 @@ new_unit_num,
|
|
|
all_video_num,
|
|
|
new_video_num,
|
|
|
effect_num,
|
|
|
+new_effect_num,
|
|
|
hot_num,
|
|
|
+new_hot_num,
|
|
|
put_campaign_num,
|
|
|
put_unit_num,
|
|
|
trust_campaign_num,
|
|
|
trust_unit_num
|
|
|
)
|
|
|
+select * from (
|
|
|
select
|
|
|
{date_time} stat_date,
|
|
|
t1.account_id,
|
|
@@ -74,8 +77,10 @@ t2.cam_num new_campaign_num,
|
|
|
t2.unit_num new_ad_num,
|
|
|
(ifnull(t1.all_video_num,0)+ifnull(t3.day_num,0)) as all_video_num,
|
|
|
t3.day_num new_video_num,
|
|
|
-t4.effect_num,
|
|
|
-t4.hot_num,
|
|
|
+(ifnull(t1.effect_num,0)+ifnull(t4.new_eff_material,0)) effect_num,
|
|
|
+ifnull(t4.new_eff_material,0) as new_effect_num,
|
|
|
+(ifnull(t1.hot_num,0)+ifnull(t5.new_hot_material,0)) as hot_num,
|
|
|
+ifnull(t5.new_hot_material,0) as new_hot_num,
|
|
|
t1.put_campaign_num,
|
|
|
t1.put_unit_num,
|
|
|
t1.trust_campaign_num,
|
|
@@ -90,15 +95,22 @@ left join
|
|
|
where date_format(stat_date,'%Y%m%d')={date_time} group by account_id) t3
|
|
|
on t1.account_id=t3.account_id
|
|
|
left join
|
|
|
-(select a.account_id,count(distinct ifnull(b.signature,null)) effect_num,count(distinct ifnull(c.signature,null)) hot_num from
|
|
|
-(select distinct account_id,signature from `media_api`.kuaishou_video_list where date_format(stat_date,'%Y%m%d')<={date_time}) a
|
|
|
-left join (select distinct signature from application.effect_material where media_id=2) b
|
|
|
-on a.signature=b.signature
|
|
|
-left join (select distinct signature from application.hot_material where media_id=2) c
|
|
|
-on a.signature=c.signature
|
|
|
-group by a.account_id) t4
|
|
|
+(select t2.account_id,count(distinct t1.material_id) new_eff_material from
|
|
|
+(select material_id from application.app_kuaishou_material_info where effect_date={date_time}) t1
|
|
|
+inner join
|
|
|
+(select distinct account_id,signature from `media_api`.kuaishou_video_list where date_format(stat_date,'%Y%m%d')>=
|
|
|
+date_sub({date_time},INTERVAL 29 DAY)) t2
|
|
|
+on t1.material_id=t2.signature group by t2.account_id) t4
|
|
|
on t1.account_id=t4.account_id
|
|
|
left join
|
|
|
+(select t2.account_id,count(distinct t1.material_id) new_hot_material from
|
|
|
+(select material_id from application.app_kuaishou_material_info where faddish_date={date_time}) t1
|
|
|
+inner join
|
|
|
+(select distinct account_id,signature from `media_api`.kuaishou_video_list where date_format(stat_date,'%Y%m%d')>=
|
|
|
+date_sub({date_time},INTERVAL 29 DAY)) t2
|
|
|
+on t1.material_id=t2.signature group by t2.account_id) t5
|
|
|
+on t1.account_id=t5.account_id
|
|
|
+left join
|
|
|
(
|
|
|
SELECT
|
|
|
cua.account_id id,
|
|
@@ -158,7 +170,9 @@ t2.unit_num new_ad_num,
|
|
|
t3.day_num as all_video_num,
|
|
|
t3.day_num new_video_num,
|
|
|
0 effect_num,
|
|
|
+0 new_effect_num,
|
|
|
0 hot_num,
|
|
|
+0 new_hot_num,
|
|
|
0 put_campaign_num,
|
|
|
0 put_unit_num,
|
|
|
0 trust_campaign_num,
|
|
@@ -211,8 +225,8 @@ LEFT JOIN `jeecg-boot`.sys_depart part ON dep.dep_id=part.id
|
|
|
WHERE
|
|
|
cua.account_id IS NOT NULL and cua.account_status=0 and cua.media_id=2
|
|
|
) bei
|
|
|
- ON t1.account_id = bei.account_id where tt.account_id is null and bei.account_id is not null;
|
|
|
- """.format(date_time=self.date_time)
|
|
|
+ON t1.account_id = bei.account_id where tt.account_id is null and bei.account_id is not null) m;
|
|
|
+ """.format(date_time=self.date_time)
|
|
|
TidbConn.upsert(conn=self.conn, sql_buff=sql)
|
|
|
self.conn.commit()
|
|
|
TidbConn.conn_close(conn=self.conn)
|