You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
908 B
28 lines
908 B
from flask import Flask, render_template, jsonify,request
|
|
from models import GetFromDB
|
|
app=Flask(__name__)
|
|
|
|
@app.route("/query_province_topn/",methods=['POST'])
|
|
def query_province_topn():
|
|
#print(request.form.get('topnum'))
|
|
#print(request.form.get('topdate'))
|
|
db=GetFromDB()
|
|
results=db.query_province_topn('2020-08-07',5)
|
|
data=jsonify(pub_dates=str(results[0][2]),areas=[x[0] for x in results],curcofirms=[x[1] for x in results])
|
|
return data
|
|
|
|
@app.route("/chinaInfo/",methods=['POST'])
|
|
def searchProvinceConfirmed():
|
|
print("------------------------------------")
|
|
db=GetFromDB()
|
|
results=db.searchProvinceConfirmed('2020-08-07')
|
|
print(results)
|
|
data=jsonify(areas=[x[0] for x in results],confirmed=[x[1] for x in results])
|
|
return data
|
|
|
|
@app.route("/")
|
|
def hello():
|
|
return render_template('hello.html')
|
|
|
|
if __name__=='__main__':
|
|
app.run(host='192.168.1.30') |