-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
66 lines (57 loc) · 1.81 KB
/
main.py
File metadata and controls
66 lines (57 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
from flask import Flask, jsonify, request,render_template
app = Flask(__name__,static_folder='image')
# 模拟数据库中的省份和城市数据
provinces = [
{"id": 1, "name": "河北", "simpleName": "冀", "proCap": "石家庄"},
{"id": 2, "name": "北京", "simpleName": "京", "proCap": "北京"},
# 可以添加更多省份
]
cities = {
1: [
{"cityId": 1, "cityName": "石家庄"},
{"cityId": 2, "cityName": "唐山"},
# 河北省的其他城市
],
2: [
{"cityId": 3, "cityName": "北京市"},
# 北京的其他城市
],
# 可以添加更多省份对应的城市
}
# 模拟数据库中的公司数据
companies = {
1: [
{"companyId": 1, "companyName": "石家庄公司A"},
{"companyId": 2, "companyName": "石家庄公司B"},
# 石家庄的其他公司
],
2: [
{"companyId": 3, "companyName": "唐山公司A"},
# 唐山的其他公司
],
3: [
{"companyId": 4, "companyName": "北京公司A"},
{"companyId": 5, "companyName": "北京公司B"},
# 北京的其他公司
],
# 可以添加更多城市对应的公司
}
@app.route(rule="/", methods=["get"])
def index():
return render_template('dome.html')
@app.route(rule="/tree", methods=["get"])
def tree():
return render_template('index.html')
@app.route('/findAllProList', methods=['GET'])
def find_all_pro_list():
return jsonify(provinces)
@app.route('/findAllCityList', methods=['GET'])
def find_all_city_list():
pro_id = int(request.args.get('proId'))
return jsonify(cities.get(pro_id, []))
@app.route('/findCompanies', methods=['GET'])
def find_companies():
city_id = int(request.args.get('cityId'))
return jsonify(companies.get(city_id, []))
if __name__ == '__main__':
app.run(debug=True)