Skip to content

Commit

Permalink
fix #5
Browse files Browse the repository at this point in the history
  • Loading branch information
zhyq0826 committed May 10, 2017
1 parent 2e72909 commit 7e38e08
Show file tree
Hide file tree
Showing 9 changed files with 236 additions and 278 deletions.
2 changes: 0 additions & 2 deletions js/area.js
Original file line number Diff line number Diff line change
Expand Up @@ -11316,7 +11316,6 @@ let area = {
"id": "451481"
}
],
"460000": [],
"460100": [
{
"city": "海口市",
Expand Down Expand Up @@ -11450,7 +11449,6 @@ let area = {
"id": "469030"
}
],
"500000": [],
"500100": [
{
"city": "市辖区",
Expand Down
10 changes: 0 additions & 10 deletions js/city.js
Original file line number Diff line number Diff line change
Expand Up @@ -1200,11 +1200,6 @@ let city = {
}
],
"460000": [
{
"province": "海南省",
"name": "海南省",
"id": "460000"
},
{
"province": "海南省",
"name": "海口市",
Expand Down Expand Up @@ -1232,11 +1227,6 @@ let city = {
}
],
"500000": [
{
"province": "重庆市",
"name": "重庆市",
"id": "500000"
},
{
"province": "重庆市",
"name": "市辖区",
Expand Down
10 changes: 0 additions & 10 deletions js/city_object.js
Original file line number Diff line number Diff line change
Expand Up @@ -1159,11 +1159,6 @@ let city_object = {
"name": "崇左市",
"id": "451400"
},
"460000": {
"province": "海南省",
"name": "海南省",
"id": "460000"
},
"460100": {
"province": "海南省",
"name": "海口市",
Expand All @@ -1189,11 +1184,6 @@ let city_object = {
"name": "省直辖县级行政区划",
"id": "469000"
},
"500000": {
"province": "重庆市",
"name": "重庆市",
"id": "500000"
},
"500100": {
"province": "重庆市",
"name": "市辖区",
Expand Down
2 changes: 0 additions & 2 deletions json/area.json
Original file line number Diff line number Diff line change
Expand Up @@ -11316,7 +11316,6 @@
"id": "451481"
}
],
"460000": [],
"460100": [
{
"city": "海口市",
Expand Down Expand Up @@ -11450,7 +11449,6 @@
"id": "469030"
}
],
"500000": [],
"500100": [
{
"city": "市辖区",
Expand Down
10 changes: 0 additions & 10 deletions json/city.json
Original file line number Diff line number Diff line change
Expand Up @@ -1200,11 +1200,6 @@
}
],
"460000": [
{
"province": "海南省",
"name": "海南省",
"id": "460000"
},
{
"province": "海南省",
"name": "海口市",
Expand Down Expand Up @@ -1232,11 +1227,6 @@
}
],
"500000": [
{
"province": "重庆市",
"name": "重庆市",
"id": "500000"
},
{
"province": "重庆市",
"name": "市辖区",
Expand Down
10 changes: 0 additions & 10 deletions json/city_object.json
Original file line number Diff line number Diff line change
Expand Up @@ -1159,11 +1159,6 @@
"name": "崇左市",
"id": "451400"
},
"460000": {
"province": "海南省",
"name": "海南省",
"id": "460000"
},
"460100": {
"province": "海南省",
"name": "海口市",
Expand All @@ -1189,11 +1184,6 @@
"name": "省直辖县级行政区划",
"id": "469000"
},
"500000": {
"province": "重庆市",
"name": "重庆市",
"id": "500000"
},
"500100": {
"province": "重庆市",
"name": "市辖区",
Expand Down
18 changes: 12 additions & 6 deletions makedata.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from collections import OrderedDict


def main():
def make_data():
source_file_list = [
'area', 'area_object', 'city', 'city_object', 'province', 'province_object']
for k in source_file_list:
Expand Down Expand Up @@ -60,9 +60,11 @@ def pull_data():
"id": c['id']
}
current_city = obj
city_object_d[c['id']] = obj
city_d.setdefault(c['id'][0:2] + '0000', []).append(obj)
area_d.setdefault(c['id'], [])
# 跳过国标页面由于 html 结构不同导致省份进入城市 json 数据
if not obj['id'] in province_object_d.keys():
city_object_d[c['id']] = obj
city_d.setdefault(c['id'][0:2] + '0000', []).append(obj)
area_d.setdefault(c['id'], [])
continue

if int(c['id']) % 1000 == 0:
Expand All @@ -86,7 +88,11 @@ def pull_data():
out_area.write(json.dumps(area_d, ensure_ascii=False, indent=4))


def main():
pull_data()
make_data()


if __name__ == '__main__':
pass
# pull_data()
print("please call main")
# main()
226 changes: 112 additions & 114 deletions mysql/city.sql

Large diffs are not rendered by default.

226 changes: 112 additions & 114 deletions postgresql/city.sql

Large diffs are not rendered by default.

0 comments on commit 7e38e08

Please sign in to comment.