Commit 53e57198 by zhaoxiqing

gsb

parent 7b8ecb53
...@@ -134,7 +134,7 @@ class YZContractApi { ...@@ -134,7 +134,7 @@ class YZContractApi {
if (!param.idNo) { if (!param.idNo) {
return this.returnjson(-1, "请提供代理人身份证号"); return this.returnjson(-1, "请提供代理人身份证号");
} }
var cludes = ["13","17","19"]; var cludes = ["13","17","18","19"];
if(!cludes.includes(param.idType)){ if(!cludes.includes(param.idType)){
return this.returnjson(-1, "个人证件类型错误"); return this.returnjson(-1, "个人证件类型错误");
} }
...@@ -169,6 +169,13 @@ class YZContractApi { ...@@ -169,6 +169,13 @@ class YZContractApi {
return this.returnjson(-1, "港澳居民来往内地通行证号码不合规"); return this.returnjson(-1, "港澳居民来往内地通行证号码不合规");
} }
} }
if(param.idType == 18){
if (!await this.idcardClient.isTWCard(param.idNo)) {
return this.returnjson(-1, "台湾居民来往大陆通行证号码不合规");
}
}
if (!param.nonceStr) { if (!param.nonceStr) {
return this.returnjson(-1, "请提供随机码"); return this.returnjson(-1, "请提供随机码");
} }
......
...@@ -184,7 +184,20 @@ class IdcardClient { ...@@ -184,7 +184,20 @@ class IdcardClient {
} }
} }
} async isTWCard(card) {
// 台湾居民来往大陆通行证
// 规则: 新版8位或18位数字, 旧版10位数字 + 英文字母
// 样本: 12345678 或 1234567890B
var reg = /^\d{8}|^[a-zA-Z0-9]{10}|^\d{18}$/;
if (reg.test(card) === false) {
return false;
} else {
return true;
}
}
}
module.exports = IdcardClient; 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