From 7c168397aeb008721c5ea0bf346343fdef2ef0ae Mon Sep 17 00:00:00 2001 From: yml2213 Date: Wed, 21 Sep 2022 14:40:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=84=9F=E8=B0=A2=20=E5=A4=A7=E4=BD=AC?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gqcq/gqcq.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/gqcq/gqcq.js b/gqcq/gqcq.js index 8d8db9f..41ad37e 100644 --- a/gqcq/gqcq.js +++ b/gqcq/gqcq.js @@ -116,7 +116,7 @@ async function user_info(name) { let result = await httpGet(Options, name); if (result.errorCode == 200) { - DoubleLog(`欢迎用户: ${result.data.nickname} 手机号:${result.data.mobile.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')}`); + DoubleLog(`欢迎用户: ${result.data.nickname} 手机号:${phone_num(result.data.mobile)}`); } else { DoubleLog(`用户查询:失败 ❌ 了呢,原因未知!`); console.log(result); @@ -558,6 +558,17 @@ function Version_Check(name, type) { +/** + * 手机号中间遮挡 + */ +function phone_num(phone_num) { + if (phone_num.length == 11) { + let data = phone_num.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2') + return data; + } else { + return phone_num; + } +}