Commit 33991e37 by 赵宇

fix

parent b0929bfc
...@@ -57,7 +57,8 @@ def menu(): ...@@ -57,7 +57,8 @@ def menu():
'陵川县': '陵川县', '陵川县': '陵川县',
'阳城县': '阳城县', '阳城县': '阳城县',
'泽州县': '泽州县', '泽州县': '泽州县',
'城区': '城区' '城区': '城区',
'晋城经济技术开发区': '晋城经济技术开发区'
} }
if not district or district == '晋城市': if not district or district == '晋城市':
...@@ -101,7 +102,7 @@ def menu(): ...@@ -101,7 +102,7 @@ def menu():
# 2. 左上角获取经济指标数据 # 2. 左上角获取经济指标数据
jjzb_data = get_jjzb(district) jjzb_data = get_jjzb(district)
# 3. 产业构分布饼状图数据统计 # 3. 产业构分布饼状图数据统计
count_all = company.count() count_all = company.count()
if count_all == 0: if count_all == 0:
count_all = 1 count_all = 1
...@@ -154,7 +155,7 @@ def project(): ...@@ -154,7 +155,7 @@ def project():
project_map = [] project_map = []
industry_money = [] industry_money = []
industry_nums = [] industry_nums = []
list1 = ["晋城市", "沁水县", "高平市", "陵川县", "阳城县", "泽州县", "城区"] list1 = ["晋城市", "沁水县", "高平市", "陵川县", "阳城县", "泽州县", "城区","晋城经济技术开发区"]
# 晋城市,点击区县之前默认数据 # 晋城市,点击区县之前默认数据
if not district or district == '晋城市': if not district or district == '晋城市':
...@@ -361,21 +362,28 @@ def policy_details(): ...@@ -361,21 +362,28 @@ def policy_details():
_id2 = int(_id) - 1 _id2 = int(_id) - 1
if _id2 < 1: if _id2 < 1:
_id2 = '' _id2 = ''
policy_len = InduPolicy.query.count()
if _id1 > policy_len:
_id1 = ''
policy = InduPolicy.query.get(_id) policy = InduPolicy.query.get(_id)
policy1 = InduPolicy.query.get(str(_id1)) policy1 = InduPolicy.query.get(str(_id1))
policy2 = InduPolicy.query.get(str(_id2)) policy2 = InduPolicy.query.get(str(_id2))
data = {"name": policy.name, # 政策名 if policy:
"file": policy.file if policy.file else "-", # 本地文件位置 data = {"name": policy.name, # 政策名
"category": policy.category if policy.category else "-", # 政策类型 "file": policy.file if policy.file else "-", # 本地文件位置
"org": policy.org if policy.org else "-", # 政策发布机构 "category": policy.category if policy.category else "-", # 政策类型
"industry": policy.industry if policy.industry else "-", # 行业名称 "org": policy.org if policy.org else "-", # 政策发布机构
"district": policy.district if policy.district else "-", # 政策发布地区 "industry": policy.industry if policy.industry else "-", # 行业名称
"pubdate": str(policy.pubdate)[0:10] if policy.pubdate else "-", # 发布时间 "district": policy.district if policy.district else "-", # 政策发布地区
"url": policy.url if policy.pubdate else "-", # 外链接 "pubdate": str(policy.pubdate)[0:10] if policy.pubdate else "-", # 发布时间
"post_num": policy.post_num if policy.post_num else "", # 发文字号 "url": policy.url if policy.pubdate else "-", # 外链接
"last": [policy2.name, _id1] if policy2 else "", "post_num": policy.post_num if policy.post_num else "", # 发文字号
"next": [policy1.name, _id2] if policy1 else ""} "last": [policy2.name, _id1] if policy2 else "",
return jsonify(code=RET.OK, msg="查找成功", data=data) "next": [policy1.name, _id2] if policy1 else ""}
return jsonify(code=RET.OK, msg="查找成功", data=data)
else:
pass
except Exception as e: except Exception as e:
current_app.logger.error(e) current_app.logger.error(e)
return jsonify(code=RET.DBERR, msg="数据库错误") return jsonify(code=RET.DBERR, msg="数据库错误")
...@@ -388,6 +396,7 @@ def showListb(): ...@@ -388,6 +396,7 @@ def showListb():
type = req_dic.get("type") # 12345678 (500强-上市-规模-专精特新-高新-科技中小-瞪羚-独角兽) type = req_dic.get("type") # 12345678 (500强-上市-规模-专精特新-高新-科技中小-瞪羚-独角兽)
district = req_dic.get("district") district = req_dic.get("district")
page = req_dic.get("page") page = req_dic.get("page")
per_page = req_dic.get("per_page")
if not all([type, district]): if not all([type, district]):
return jsonify(code=RET.PARAMERR, msg="参数错误") return jsonify(code=RET.PARAMERR, msg="参数错误")
...@@ -428,7 +437,7 @@ def showListb(): ...@@ -428,7 +437,7 @@ def showListb():
if type == 8: if type == 8:
company = company.filter_by(unicorn=1) company = company.filter_by(unicorn=1)
size = company.count() size = company.count()
company = company.paginate(page, per_page=4).items company = company.paginate(page, per_page=int(per_page)).items
data = [{ data = [{
"id": i.id, "id": i.id,
"name": i.company_name, "name": i.company_name,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment