From 42d2af7ede8bff43403dea943b85929c7733fc64 Mon Sep 17 00:00:00 2001 From: metowolf Date: Fri, 21 Feb 2025 16:40:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=AD=E5=9B=BD=E8=A1=8C?= =?UTF-8?q?=E6=94=BF=E5=8C=BA=E7=A0=81=E8=AF=86=E5=88=AB=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/cac/index.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/plugins/cac/index.js b/src/plugins/cac/index.js index 6caf1909..ec1ced4b 100644 --- a/src/plugins/cac/index.js +++ b/src/plugins/cac/index.js @@ -3,8 +3,12 @@ const list = require('./data') const query = (country, region, city) => { if (country === '中国') { if (list[region]) { - const result = list[region][city] || list[region][region] - return result.toString() + if (!city) { + return list[region][region].toString() + } + if (list[region][city]) { + return list[region][city].toString() + } } // 尝试前缀匹配 for (const key in list) { @@ -29,7 +33,7 @@ const query = (country, region, city) => { if (country === '中国澳门') { return '820000' } - if (country === '中国台湾') { + if (country === '中国台湾' || country === '台湾') { return '710000' } return ''