添加daily report生成

This commit is contained in:
pengtao 2019-10-22 15:16:35 +08:00
parent b712a04fb4
commit b4d05e25cb
2 changed files with 11 additions and 10 deletions

View File

@ -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 '<h1>邮件发送成功</h1>'
return jsonify("邮件发送成功")
class Report:

View File

@ -7,7 +7,7 @@
<body>
<h1>学生表</h1>
<h2>游戏ID{{ data.get(gameid) }}</h2>>
<h2>游戏ID{{% data.get(gameid) %}}</h2>>
<h2>渠道ID{{ data.get('channelid') }}</h2>>
<h2>日期:{{ data.get(day) }}</h2>
<h1>总表</h1>>
@ -23,9 +23,9 @@
<td>插屏显示</td>
</tr>
</body>
{ % for item in data.get('all') % }
{% for item in data.get('all') %}
<th>{{ item }}</th>
{ % endfor % }
{% endfor %}
<h1>导入数据:</h1>>
<tr>
@ -56,13 +56,13 @@
<td>跳转人数</td>
</tr>
{ % for line in data.get('output') % }
{% for line in data.get('output') %}
<tr>
{ % for item in line % }
{% for item in line %}
<th>{{ item }}</th>
{ % endfor % }
{% endfor %}
</tr>
{ % endfor % }
{% endfor %}
</body>
</html>