|
@@ -23,12 +23,11 @@ class MateirialVideoDailyReport:
|
|
|
|
|
|
def daily_report(self):
|
|
|
try:
|
|
|
- sql = """select count(1) from media_api.kuaishou_material_video_report_daily where
|
|
|
- stat_date between {start_time} and {end_time}""".format(
|
|
|
+ sql = """select advertiser_id from media_api.kuaishou_material_video_report_daily where
|
|
|
+ stat_date between {start_time} and {end_time} group by advertiser_id""".format(
|
|
|
start_time=self.start_time, end_time=self.end_time)
|
|
|
- totalNum = TidbConn.quary(sql)[0][0]
|
|
|
- pageCount = ceil(totalNum / 10000)
|
|
|
- for i in range(pageCount):
|
|
|
+ account_list = TidbConn.quary(sql)
|
|
|
+ for account_id in account_list:
|
|
|
sql = """replace into application.kuaishou_material_video_report_daily_dw
|
|
|
(account_id, project_id, product_id, advertiser_id,
|
|
|
company_id, account_name, project_name,
|
|
@@ -289,8 +288,8 @@ from media_api.kuaishou_material_video_report_daily report
|
|
|
left join `jeecg-boot`.user_company uc on uc.user_id = clip.id
|
|
|
left join `jeecg-boot`.ctop_product product on product.id = cp.product_id
|
|
|
where report.stat_date between {start_time} and {end_time} and report.photo_id!=0
|
|
|
- order by advertiser_id,photo_id ,stat_date limit {num},10000""".format(
|
|
|
- start_time=self.start_time, end_time=self.end_time, num=i * 10000)
|
|
|
+ and report.advertiser_id={account_id}""".format(
|
|
|
+ start_time=self.start_time, end_time=self.end_time, account_id=account_id)
|
|
|
print(sql)
|
|
|
TidbConn.upsert(conn=self.conn, sql_buff=sql)
|
|
|
self.conn.commit()
|
|
@@ -308,4 +307,4 @@ if __name__ == '__main__':
|
|
|
exit(0)
|
|
|
else:
|
|
|
print("作业执行失败")
|
|
|
- exit(-1)
|
|
|
+ exit(-1)
|