新增周报脚本
This commit is contained in:
parent
4e7de25c4c
commit
8ca93678d8
@ -95,6 +95,30 @@ def send_dailyreport():
|
|||||||
return jsonify("get Data Failed!")
|
return jsonify("get Data Failed!")
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/send-tapweekly')
|
||||||
|
def send_tapweekly():
|
||||||
|
title = "TAP周报"
|
||||||
|
day = request.args.get('day')
|
||||||
|
recipients = ["pengtao@kingsome.cn"]
|
||||||
|
msg = Message(title, sender=sender, recipients=recipients)
|
||||||
|
from taptap.tap_weekly_mail import TapWeeklyReport
|
||||||
|
twr = TapWeeklyReport(day)
|
||||||
|
data = twr.build()
|
||||||
|
print(data)
|
||||||
|
# data[day] = day
|
||||||
|
msg.subject = f"TAPTAP_{day}_游戏周报"
|
||||||
|
if data:
|
||||||
|
msg.html = render_template('tap_weekly.html', data=data, day=day)
|
||||||
|
|
||||||
|
thread = Thread(target=send_async_email, args=[app, msg])
|
||||||
|
thread.start()
|
||||||
|
|
||||||
|
return jsonify("邮件发送成功")
|
||||||
|
else:
|
||||||
|
return jsonify("get Data Failed!")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Report:
|
class Report:
|
||||||
def __init__(self, day, project):
|
def __init__(self, day, project):
|
||||||
self.day = day
|
self.day = day
|
||||||
|
44
daily_report/templates/tap_weekly.html
Normal file
44
daily_report/templates/tap_weekly.html
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>TAP周报</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1 class="title">金蚕游戏日报 · OPS</h1>
|
||||||
|
<p class="date">{{ day }}</p>
|
||||||
|
{% for key in data.keys() %}
|
||||||
|
<div class="section">
|
||||||
|
<div class="info">
|
||||||
|
<span
|
||||||
|
>报表类型:<span class="gameid">{{ key }}</span></span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="panel">
|
||||||
|
<h2>总表</h2>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>游戏ID</th>
|
||||||
|
<th>游戏名称</th>
|
||||||
|
<th>排名</th>
|
||||||
|
<th>排名变动</th>
|
||||||
|
<th>关注变动</th>
|
||||||
|
<th>下载变化</th>
|
||||||
|
<th>评论变化</th>
|
||||||
|
<th>评分</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
{% for item in data.get(key) %}
|
||||||
|
<td>{{ item }}</td>
|
||||||
|
{% endfor %}
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -33,7 +33,7 @@ class TapWeeklyReport:
|
|||||||
sql = f"""select
|
sql = f"""select
|
||||||
gameid,
|
gameid,
|
||||||
title,
|
title,
|
||||||
min(`order`), sum(diff_order), sum(diff_watch), sum(diff_download), sum(diff_reserve), score
|
min(`order`), sum(diff_order), sum(diff_watch), sum(diff_download), sum(diff_topic), score
|
||||||
from
|
from
|
||||||
taptap_collect
|
taptap_collect
|
||||||
where
|
where
|
||||||
|
Loading…
x
Reference in New Issue
Block a user