|
@@ -27,27 +27,13 @@ class send_material_report_weekly:
|
|
|
self.stat_date = (datetime.date.today() + datetime.timedelta(-1)).strftime("%Y-%m-%d")
|
|
|
|
|
|
def handler(self):
|
|
|
- sql = """SELECT
|
|
|
- ifnull(t2.company_name,'0') AS '公司',
|
|
|
- ifnull(t3.project_name,'-') AS '项目',
|
|
|
- ifnull(t2.video_code,'-') AS '素材标识',
|
|
|
- ifnull(t2.state_date,'-') AS '上线时间',
|
|
|
- ifnull(t2.channel_name,'-') AS '渠道',
|
|
|
- round(sum(t1.charge),3) AS '消耗',
|
|
|
- ifnull(t2.clip_name,'-') AS '剪辑',
|
|
|
- ifnull(t2.shot_name,'-') AS '拍摄',
|
|
|
- ifnull(t2.plan_name,'-') AS '编导',
|
|
|
- ifnull(t2.design_team_leader_name,'-') AS '负责人',
|
|
|
- ifnull(t2.video_name,'-') AS '素材名称',
|
|
|
- ifnull(t2.url,'-') AS '链接'
|
|
|
-FROM
|
|
|
-`jeecg-boot`.ctop_etl_kuaishou_account_material_report_daily t1
|
|
|
-LEFT JOIN `jeecg-boot`.ctop_etl_kuaishou_video_info t2 ON t1.signature = t2.video_code
|
|
|
-LEFT JOIN `jeecg-boot`.ctop_project t3
|
|
|
-on t1.project_id=t3.id
|
|
|
-where t1.stat_date between date_sub('{stat_date}', INTERVAL 6 DAY) and '{stat_date}'
|
|
|
-GROUP BY
|
|
|
-t1.signature""".format(stat_date=self.stat_date)
|
|
|
+ sql = """select company_id as '分公司id',company_name as '分公司名称',account_id as '账户id',account_name as'账户名称',project_name as'项目名称',
|
|
|
+a.signature as '素材id',b.frast_cost_time as'素材首次消耗时间',video_name as '素材名称',sum(charge) as '消耗',clip_name as '剪辑',shot_name as '拍摄',plan_name as '编导',leader_name as '负责人',photo_url as '视频链接',channel_name as '渠道类型'
|
|
|
+from application.app_kuaishou_video_report_busi_m a
|
|
|
+left join application.material_farst_cost_time b
|
|
|
+on a.signature=b.signature
|
|
|
+where stat_mon=202112
|
|
|
+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)
|
|
@@ -62,7 +48,7 @@ t1.signature""".format(stat_date=self.stat_date)
|
|
|
# [收件人邮箱昵称、收件人邮箱账号], 昵称随便
|
|
|
msg['To'] = ",".join(recipients)
|
|
|
# 邮件的主题,也就是邮件的标题
|
|
|
- msg['Subject'] = "快手-全量素材周报"
|
|
|
+ msg['Subject'] = "快手-全量素材月报"
|
|
|
|
|
|
att1 = MIMEText(
|
|
|
open(path, 'rb').read(), 'base64', 'utf-8')
|