Commit 69db1e3d by zhaoxiqing

gsb

parent 53e57198
......@@ -158,7 +158,6 @@ class IdcardClient {
}
async isHKCard(card) {
// 港澳居民来往内地通行证
// 规则: H/M + 10位或6位数字
......@@ -197,13 +196,31 @@ class IdcardClient {
}
async isAccountCard(card) {
// 户口本
// 规则: 15位数字, 18位数字, 17位数字 + X
// 样本: 441421999707223115
var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
if (reg.test(card) === false) {
return {'status': 0, 'msg': '户口本号码不合规'};
} else {
return {'status': 1, 'msg': '校验通过'};
}
}
module.exports = IdcardClient;
// 函数参数必须是字符串,因为二代身份证号码是十八位,而在javascript中,十八位的数值会超出计算范围,造成不精确的结果,导致最后两位和计算的值不一致,从而该函数出现错误。
// 详情查看javascript的数值范围
function checkIDCard(idcode) {
async isOfficerCard(card) {
// 军官证
// 规则: 军/兵/士/文/职/广/(其他中文) + "字第" + 4到8位字母或数字 + "号"
// 样本: 军字第2001988号, 士字第P011816X号
var reg = /^[\u4E00-\u9FA5](字第)([0-9a-zA-Z]{4,8})(?)$/;
if (reg.test(card) === false) {
return {'status': 0, 'msg': '军官证号不合规'};
} else {
return {'status': 1, 'msg': '校验通过'};
}
}
}
module.exports = IdcardClient;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment