Skip to content

Commit

Permalink
fix: fix level.min data error issue. (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Nov 17, 2023
1 parent 35107cf commit f63b44d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/core/dist/level.min.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions packages/core/script/level.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,22 @@ const province = require('../dist/province.json')
const minData = province.map(p => {
let cData = [...city].filter(m => m.province === p.province && /00$/.test(m.code)).map(m => {
m.children = area.filter(a => a.city === m.city && a.province === m.province).map((child) => ({
c: child.code, n: child.name, p: child.province, d: child.city, a: child.area
c: child.code, n: child.name, p: child.province, y: child.city, a: child.area
}));
return { c: m.code, n: m.name, p: m.province, d: m.children };
return { c: m.code, n: m.name, p: m.province, y: m.city, d: m.children };
});
if (/^(11|31|12|50)$/.test(p.province) && cData.length === 0) {
cData = area.filter(c => c.province === p.province).map((child) => ({
c: child.code, n: child.name, p: child.province, d: child.city, a: child.area
c: child.code, n: child.name, p: child.province, y: child.city, a: child.area
}));
}
if (/^(81|82)$/.test(p.province) && cData.length === 0) {
cData = [...hongkong, ...macau].filter(c => c.province === p.province).map((child) => ({
c: child.code, n: child.name, p: child.province, d: child.city, a: child.area
c: child.code, n: child.name, p: child.province, y: child.city, a: child.area
}));
}
p.children = cData;
return { c: p.code, n: p.name, p: p.province, d: p.children };
return { c: p.code, n: p.name, p: p.province, y: p.city, d: p.children };
});
await FS.outputFile(minDataPath, JSON.stringify(minData));
console.log(' \x1b[32;1m✔\x1b[0m 数据保存:', path.relative(process.cwd(), minDataPath));
Expand Down

0 comments on commit f63b44d

Please sign in to comment.