commit
4d43485651
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,38 @@
|
||||
# encoding: utf-8
|
||||
import flask
|
||||
from flask import jsonify
|
||||
from flask import render_template
|
||||
from app.mydb import MyDB
|
||||
|
||||
app = flask.Flask(__name__)
|
||||
|
||||
|
||||
@app.route('/')
|
||||
def start(name=None):
|
||||
# return render_template('echartstest1.html', name=name)
|
||||
return render_template('covid2019_show.html', name=name)
|
||||
|
||||
|
||||
@app.route('/query_province_datas', methods=["GET", "POST"])
|
||||
def query_province_datas():
|
||||
mydb = MyDB('localhost', 'root', '123456', 'conv19_datas')
|
||||
datas = mydb.province_curConfirm_top_n()
|
||||
ret = jsonify(pub_date=datas[0][2], areas=[x[1] for x in datas], curconfirms=[x[0] for x in datas])
|
||||
return ret
|
||||
|
||||
|
||||
@app.route('/query_province_import_datas', methods=["GET", "POST"])
|
||||
def query_province_import_datas():
|
||||
mydb = MyDB('localhost', 'root', '123456', 'conv19_datas')
|
||||
datas = mydb.province_import_top_n()
|
||||
ret = jsonify(pub_date=datas[0][3], provinces=[x[0] for x in datas], confirmed=[x[1] for x in datas], curconfirms=[x[2] for x in datas])
|
||||
return ret
|
||||
|
||||
|
||||
@app.route('/query_city_datas')
|
||||
def query_city_datas():
|
||||
return '查询地级市数据...'
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True)
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,11 @@
|
||||
<html>
|
||||
<body>
|
||||
|
||||
<form action = "http://localhost:5000/login" method = "post">
|
||||
<p>Enter Name:</p>
|
||||
<p><input type = "text" name = "nm" /></p>
|
||||
<p><input type = "submit" value = "submit" /></p>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,16 @@
|
||||
# encoding: utf-8
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
|
||||
# 获取当日日期
|
||||
def get_cur_date():
|
||||
date = datetime.today()
|
||||
date = date.strftime('%Y.%m.%d')
|
||||
return date
|
||||
|
||||
|
||||
# 获取前n日的日期
|
||||
def get_pre_n_date(n=1):
|
||||
predate = datetime.today() + timedelta(-n)
|
||||
predate = predate.strftime('%Y.%m.%d')
|
||||
return predate
|
Loading…
Reference in new issue