Skip to content

Commit

Permalink
更新多个银行的电话号码,移除不合规的106长号码
Browse files Browse the repository at this point in the history
  • Loading branch information
metowolf committed Jan 6, 2025
1 parent 29228dc commit 2beb793
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions data/通讯服务/中国电信.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ basic:
- 1000010
- 10001666
- 1065911468 # 漏话提醒
- 10659210000
url: https://www.189.cn/
1 change: 1 addition & 0 deletions data/通讯服务/中国联通.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ basic:
- 10016
- 10018
- 101906 # 沃助理
- 10655152 # 出境服务
url: https://www.10010.com/
5 changes: 5 additions & 0 deletions data/金融银行/中国银行.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@ basic:
organization: 中国银行
cellPhone:
- 95566
- 106980095566
- 10659020295566
- 10690698395566
- 10690661695566
- 10691197095566
url: https://www.boc.cn/
8 changes: 8 additions & 0 deletions src/plugins/vcard.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ const plugin = (file, _, cb) => {
for (const [key, value] of Object.entries(json.basic)) {
vCard[key] = value
}
// 移除 cellPhone 中 106 长号码
if (vCard.cellPhone) {
vCard.cellPhone = vCard.cellPhone
.filter((phone) => {
const phoneStr = `${phone}`
return !phoneStr.startsWith('106') || phoneStr.length <= 11
})
}
vCard.photo.embedFromFile(path.replace('.yaml', '.png'))
file.contents = Buffer.from(vCard.getFormattedString())
cb(null, file)
Expand Down
7 changes: 0 additions & 7 deletions src/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,6 @@ const checkVCard = (t, path) => {
t.fail(`schema 校验失败 ${error.message}, ${JSON.stringify(value)}`)
}

for (let phone of json.basic.cellPhone) {
// 不收录 106 短信通道号码(短号码例外)
if (phone.toString().substr(0, 3) === '106' && phone.toString().length > 10) {
t.fail(`不收录 ${phone},原因:106 短信通道号码`)
}
}

for (const block of blockList) {
if (block.organization === json.basic.organization) {
t.fail(`不收录 ${block.organization},原因:${block.reason}`)
Expand Down

0 comments on commit 2beb793

Please sign in to comment.