diff --git a/daily_report/dreport.py b/daily_report/dreport.py index 8c5cd5f..f712774 100644 --- a/daily_report/dreport.py +++ b/daily_report/dreport.py @@ -72,13 +72,16 @@ def send_dailyreport(): data = rp.run() print(data) #data[day] = day - msg.subject = f"{project}_{day}_数据" - msg.html = render_template('report.html', data=data, day=day) + if data: + msg.subject = f"{project}_{day}_数据" + msg.html = render_template('report.html', data=data, day=day) - thread = Thread(target=send_async_email, args=[app, msg]) - thread.start() + thread = Thread(target=send_async_email, args=[app, msg]) + thread.start() - return jsonify("邮件发送成功") + return jsonify("邮件发送成功") + else: + return jsonify("get Data Failed!") class Report: @@ -303,8 +306,10 @@ class Report: def run(self): if self.project == 'mini_games': parms = [(1004, 6001), (1011, 6001), (1001, 6001)] - else: + elif self.project == '2001': parms = [(2001, 6001), (2002, 6001)] + else: + return None cn = self.get_args_cn() if not cn: