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.
47 lines
1.4 KiB
47 lines
1.4 KiB
6 months ago
|
'''
|
||
|
疫情数据模块
|
||
|
'''
|
||
|
from flask import Blueprint,request,render_template,jsonify
|
||
|
import adminProcess
|
||
|
|
||
|
yq = Blueprint("yq",__name__)
|
||
|
|
||
|
# 数据管理部分
|
||
|
@yq.route("/admin/result_yq")
|
||
|
def result_yq():
|
||
|
# 获取来源的参数
|
||
|
page = request.args.get('page')
|
||
|
if page is None: page = 1
|
||
|
# 增加获取一共多少页的代码
|
||
|
data = {}
|
||
|
data['totalPage']=adminProcess.getDataListPage(tableName='yq')
|
||
|
data['currentPage'] = int(page)
|
||
|
data['yq']=adminProcess.getDataListByPage(tableName='yq',page=int(page))
|
||
|
return render_template("admin/yq.html",data=data)
|
||
|
|
||
|
'''处理疫情数据采集'''
|
||
|
@yq.route("/admin/yqCollect")
|
||
|
def yqCollect():
|
||
|
sourceID = request.args.get('source')
|
||
|
if adminProcess.yqFetch(sourceID):
|
||
|
return jsonify({'code':200,'msg':"爬取成功!"})
|
||
|
else:
|
||
|
return jsonify({'code':200,'msg':'爬取失败!'})
|
||
|
|
||
|
'''处理疫情数据删除'''
|
||
|
@yq.route("/admin/yqDelete")
|
||
|
def yqDelete():
|
||
|
id = request.args.get('id')
|
||
|
if adminProcess.newsDelete("yq",id):
|
||
|
return jsonify({'code':200,'msg':'删除成功!'})
|
||
|
else:
|
||
|
return jsonify({'code':404,'msg':'删除不成功!'})
|
||
|
|
||
|
'''处理疫情数据显示'''
|
||
|
@yq.route("/admin/yqShow")
|
||
|
def yqShow():
|
||
|
id = request.args.get('id')
|
||
|
if adminProcess.newsShow("yq",id):
|
||
|
return jsonify({'code':200,'msg':'删除成功!'})
|
||
|
else:
|
||
|
return jsonify({'code':404,'msg':'删除不成功!'})
|