|
@@ -27,20 +27,20 @@ class send_material_report_weekly:
|
|
|
self.stat_date = (datetime.date.today() + datetime.timedelta(-1)).strftime("%Y-%m-%d")
|
|
|
|
|
|
def handler(self):
|
|
|
- sql = """select a.company_id as '分公司id',a.company_name as '分公司名称',a.account_id as '账户id',a.account_name as'账户名称',a.project_name as'项目名称',
|
|
|
-a.signature as '素材id',b.media_time as '素材上线时间',a.video_name as '素材名称',sum(a.charge) as '消耗',
|
|
|
-a.clip_name as '剪辑',a.shot_name as '拍摄',a.plan_name as '编导',a.leader_name as '负责人',a.photo_url as '视频链接',a.channel_name as '渠道类型'
|
|
|
+ sql = """select a.clip_company_id as '分公司id',b.company_name as '分公司名称',a.account_id as '账户id',a.account_name as'账户名称',a.project_name as'项目名称',
|
|
|
+a.signature as '素材id',b.media_time as '素材上线时间',a.video_name as '素材名称',sum(a.cost) as '消耗',
|
|
|
+a.clip_name as '剪辑',a.shot_name as '拍摄',a.plan_name as '编导',a.leader_name as '负责人',a.video_url as '视频链接',a.channel_name as '渠道类型'
|
|
|
from
|
|
|
-(select * from application.kuaishou_material_video_report_daily_dw where stat_date between 20211201 and 20211231) a
|
|
|
-left join application.app_kuaishou_material_info b
|
|
|
-ON a.signature=b.material_id
|
|
|
-group by a.account_id,a.signature""".format(stat_date=self.stat_date)
|
|
|
+(select * from application.bytedance_material_video_report_daily_dw where stat_datetime=20211201) a
|
|
|
+left join application.app_bytedance_material_info b
|
|
|
+ON a.signature=b.material_id
|
|
|
+group by a.account_id,a.signature """.format(stat_date=self.stat_date)
|
|
|
print(sql)
|
|
|
path = """/data/excel/material_week_{stat_date}.xls""".format(stat_date=self.stat_date)
|
|
|
print(path)
|
|
|
pd.read_sql(sql, self.OuterConn).to_excel(path, index=False, engine='openpyxl')
|
|
|
my_sender = 'zhaohailiang@c-top.com.cn' # 发件人邮箱账号
|
|
|
- my_pass = 'Ab*75137' # 发件人邮箱授权码 / 腾讯企业邮箱请使用登陆密码
|
|
|
+ my_pass = 'h27UwLdJcD797THk' # 发件人邮箱授权码 / 腾讯企业邮箱请使用登陆密码
|
|
|
recipients = ['renyupeng@c-top.com.cn',] # 收件人邮箱账号
|
|
|
# content = "Please check the attachment. "
|
|
|
msg = MIMEMultipart()
|