代码拉取完成,页面将自动刷新
同步操作将从 modood/Administrative-divisions-of-China 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/usr/bin/env bash
sqlite3 ./dist/data.sqlite "SELECT code,name FROM province ORDER BY code;" | awk -F'|' '
{ code[++i]=$1; name[i]=$2 }
END {
printf "[";
for(j=1;j<=i;j++){
printf "{|code|:|%s|,|name|:|%s|",code[j],name[j]
closing="},"
if(j==i){closing="}"}
printf closing;
}
printf "]";
}' | tr '|' '"' > ./dist/provinces.json
sqlite3 ./dist/data.sqlite "SELECT code,name,provinceCode FROM city ORDER BY code;" | awk -F'|' '
{ code[++i]=$1; name[i]=$2; provinceCode[i]=$3 }
END {
printf "[";
for(j=1;j<=i;j++){
printf "{|code|:|%s|,|name|:|%s|,|provinceCode|:|%s|",code[j],name[j],provinceCode[j]
closing="},"
if(j==i){closing="}"}
printf closing;
}
printf "]";
}' | tr '|' '"' > ./dist/cities.json
sqlite3 ./dist/data.sqlite "SELECT code,name,cityCode,provinceCode FROM area ORDER BY code;" | awk -F'|' '
{ code[++i]=$1; name[i]=$2; cityCode[i]=$3; provinceCode[i]=$4 }
END {
printf "[";
for(j=1;j<=i;j++){
printf "{|code|:|%s|,|name|:|%s|,|cityCode|:|%s|,|provinceCode|:|%s|",code[j],name[j],cityCode[j],provinceCode[j]
closing="},"
if(j==i){closing="}"}
printf closing;
}
printf "]";
}' | tr '|' '"' > ./dist/areas.json
sqlite3 ./dist/data.sqlite "SELECT code,name,areaCode,cityCode,provinceCode FROM street ORDER BY code;" | awk -F'|' '
{ code[++i]=$1; name[i]=$2; areaCode[i]=$3; cityCode[i]=$4; provinceCode[i]=$5 }
END {
printf "[";
for(j=1;j<=i;j++){
printf "{|code|:|%s|,|name|:|%s|,|areaCode|:|%s|,|cityCode|:|%s|,|provinceCode|:|%s|",code[j],name[j],areaCode[j],cityCode[j],provinceCode[j]
closing="},"
if(j==i){closing="}"}
printf closing;
}
printf "]";
}' | tr '|' '"' > ./dist/streets.json
sqlite3 ./dist/data.sqlite "SELECT code,name,streetCode,areaCode,cityCode,provinceCode FROM village ORDER BY code;" | awk -F'|' '
{ code[++i]=$1; name[i]=$2; streetCode[i]=$3; areaCode[i]=$4; cityCode[i]=$5; provinceCode[i]=$6 }
END {
printf "[";
for(j=1;j<=i;j++){
printf "{|code|:|%s|,|name|:|%s|,|streetCode|:|%s|,|areaCode|:|%s|,|cityCode|:|%s|,|provinceCode|:|%s|",code[j],name[j],streetCode[j],areaCode[j],cityCode[j],provinceCode[j]
closing="},"
if(j==i){closing="}"}
printf closing;
}
printf "]";
}' | tr '|' '"' > ./dist/villages.json
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。