From b4d05e25cbcb5e2d93aaeb8fb0dd3b83624358d0 Mon Sep 17 00:00:00 2001 From: pengtao Date: Tue, 22 Oct 2019 15:16:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0daily=20report=E7=94=9F?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- daily_report/dreport.py | 7 ++++--- daily_report/templates/report.html | 14 +++++++------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/daily_report/dreport.py b/daily_report/dreport.py index 5ed296a..8607aa4 100644 --- a/daily_report/dreport.py +++ b/daily_report/dreport.py @@ -2,7 +2,7 @@ from __future__ import absolute_import from ops.mtga import GetTgaConfig, FromTga import os -from flask import Flask, render_template, request +from flask import Flask, render_template, request, jsonify from flask_mail import Mail, Message from threading import Thread from collections import defaultdict @@ -42,7 +42,8 @@ def send_dailyreport(): gameid = request.args.get('gameid') channelid = request.args.get('channelid') day = request.args.get('day') - + if not (gameid and channelid and day): + return jsonify("PLS input arfs") rp = Report(gameid, channelid, day) data = rp.run() data[gameid] = gameid @@ -54,7 +55,7 @@ def send_dailyreport(): thread = Thread(target=send_async_email, args=[app, msg]) thread.start() - return '

邮件发送成功

' + return jsonify("邮件发送成功") class Report: diff --git a/daily_report/templates/report.html b/daily_report/templates/report.html index 663383c..c7154db 100644 --- a/daily_report/templates/report.html +++ b/daily_report/templates/report.html @@ -7,7 +7,7 @@

学生表

-

游戏ID:{{ data.get(gameid) }}

> +

游戏ID:{{% data.get(gameid) %}}

>

渠道ID:{{ data.get('channelid') }}

>

日期:{{ data.get(day) }}

总表

> @@ -23,9 +23,9 @@ 插屏显示 -{ % for item in data.get('all') % } +{% for item in data.get('all') %} {{ item }} -{ % endfor % } +{% endfor %}

导入数据:

> @@ -56,13 +56,13 @@ 跳转人数 -{ % for line in data.get('output') % } +{% for line in data.get('output') %} - { % for item in line % } + {% for item in line %} {{ item }} - { % endfor % } + {% endfor %} -{ % endfor % } +{% endfor %} \ No newline at end of file