Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
7b8ecb53
Commit
7b8ecb53
authored
Apr 27, 2020
by
zhaoxiqing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
ba1c5de8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
14 deletions
+59
-14
bpo-web/app/base/api/impl/yzcontractApi.js
+31
-13
bpo-web/app/base/service/impl/entcontractSve.js
+1
-1
bpo-web/app/base/utils/idcardClient.js
+27
-0
No files found.
bpo-web/app/base/api/impl/yzcontractApi.js
View file @
7b8ecb53
...
...
@@ -118,6 +118,7 @@ class YZContractApi {
mobile
:
this
.
trim
(
pobj
.
mobile
),
// 代理人手机号
idNo
:
this
.
trim
(
pobj
.
idNo
),
// 代理人身份证
nonceStr
:
this
.
trim
(
pobj
.
nonceStr
),
//随机码
idType
:
this
.
trim
(
pobj
.
idType
),
sign
:
this
.
trim
(
pobj
.
sign
)
};
console
.
log
(
"有赞商户签约接口==========="
,
param
);
...
...
@@ -133,24 +134,41 @@ class YZContractApi {
if
(
!
param
.
idNo
)
{
return
this
.
returnjson
(
-
1
,
"请提供代理人身份证号"
);
}
if
(
!
await
this
.
idcardClient
.
checkIDCard
(
param
.
idNo
))
{
return
this
.
returnjson
(
-
1
,
"代理人身份证格式不正确"
);
var
cludes
=
[
"13"
,
"17"
,
"19"
];
if
(
!
cludes
.
includes
(
param
.
idType
)){
return
this
.
returnjson
(
-
1
,
"个人证件类型错误"
);
}
let
card
=
await
this
.
idcardClient
.
cardInfo
(
param
.
idNo
);
let
age
=
card
.
age
||
0
;
if
(
!
age
)
{
return
this
.
returnjson
(
-
1
,
"代理人身份证号格式错误, 只支持18位身份证号码"
);
}
if
(
card
.
sex
==
'male'
)
{
if
(
age
<
18
||
age
>
60
)
{
return
this
.
returnjson
(
-
1
,
"签约失败,男性代理人限制18-60岁之间"
);
if
(
param
.
idType
==
19
){
if
(
!
await
this
.
idcardClient
.
checkIDCard
(
param
.
idNo
))
{
return
this
.
returnjson
(
-
1
,
"代理人身份证格式不正确"
);
}
let
card
=
await
this
.
idcardClient
.
cardInfo
(
param
.
idNo
);
let
age
=
card
.
age
||
0
;
if
(
!
age
)
{
return
this
.
returnjson
(
-
1
,
"代理人身份证号格式错误, 只支持18位身份证号码"
);
}
}
else
{
if
(
age
<
18
||
age
>
55
)
{
return
this
.
returnjson
(
-
1
,
"签约失败,女性代理人限制18-55岁之间"
);
if
(
card
.
sex
==
'male'
)
{
if
(
age
<
18
||
age
>
60
)
{
return
this
.
returnjson
(
-
1
,
"签约失败,男性代理人限制18-60岁之间"
);
}
}
else
{
if
(
age
<
18
||
age
>
55
)
{
return
this
.
returnjson
(
-
1
,
"签约失败,女性代理人限制18-55岁之间"
);
}
}
}
if
(
param
.
idType
==
13
){
if
(
!
await
this
.
idcardClient
.
isPassPortCard
(
param
.
idNo
))
{
return
this
.
returnjson
(
-
1
,
"护照号码不合规"
);
}
}
if
(
param
.
idType
==
17
){
if
(
!
await
this
.
idcardClient
.
isHKCard
(
param
.
idNo
))
{
return
this
.
returnjson
(
-
1
,
"港澳居民来往内地通行证号码不合规"
);
}
}
if
(
!
param
.
nonceStr
)
{
return
this
.
returnjson
(
-
1
,
"请提供随机码"
);
}
...
...
bpo-web/app/base/service/impl/entcontractSve.js
View file @
7b8ecb53
...
...
@@ -665,7 +665,7 @@ class EntcontractService extends ServiceBase {
thirdId
:
thirdId
,
name
:
eaccount
.
userName
,
idNo
:
eaccount
.
personsSign
,
idType
:
19
,
idType
:
params
.
idType
,
mobile
:
eaccount
.
mobile
};
var
getAccount
=
await
this
.
utilesignbaoSve
.
createAccountId
(
createParams
,
"econtractSve"
);
...
...
bpo-web/app/base/utils/idcardClient.js
View file @
7b8ecb53
...
...
@@ -157,6 +157,33 @@ class IdcardClient {
}
}
async
isHKCard
(
card
)
{
// 港澳居民来往内地通行证
// 规则: H/M + 10位或6位数字
// 样本: H1234567890
var
reg
=
/^
([
A-Z
]\d{6,10}(\(\w{1}\))?)
$/
;
if
(
reg
.
test
(
card
)
===
false
)
{
return
false
;
}
else
{
return
true
;
}
}
async
isPassPortCard
(
card
)
{
// 护照
// 规则: 14/15开头 + 7位数字, G + 8位数字, P + 7位数字, S/D + 7或8位数字,等
// 样本: 141234567, G12345678, P1234567
var
reg
=
/^
([
a-zA-z
]
|
[
0-9
]){5,17}
$/
;
if
(
reg
.
test
(
card
)
===
false
)
{
return
false
;
}
else
{
return
true
;
}
}
}
module
.
exports
=
IdcardClient
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment