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
3917150f
Commit
3917150f
authored
Aug 28, 2020
by
DESKTOP-7Q3CA17\86137
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
08746d2b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
223 additions
and
33 deletions
+223
-33
bpo-web/app/base/api/impl/gemaApi.js
+132
-31
bpo-web/app/base/db/impl/qbgconfigDao.js
+10
-0
bpo-web/app/base/db/models/qbgconfig.js
+54
-0
bpo-web/app/base/db/models/usereaccount.js
+2
-2
bpo-web/app/base/service/impl/qbgconfigSve.js
+0
-0
bpo-web/app/config/settings.js
+25
-0
No files found.
bpo-web/app/base/api/impl/gemaApi.js
View file @
3917150f
//
var
system
=
require
(
"../../system"
)
// 北京歌马科技有限公司方案
const
md5
=
require
(
"MD5"
);
//
const
logCtl
=
system
.
getObject
(
"web.oplogCtl"
);
// 使用签必果进行,三要素认证和静默签
const
moment
=
require
(
"moment"
);
//
const
uuidv1
=
require
(
'uuid/v1'
);
//
// 前期数据准备
class
GemaApi
{
// 1. 创建企业账户和个人账户
constructor
()
{
//
this
.
etemplatebusiSve
=
system
.
getObject
(
"service.etemplatebusiSve"
);
// 2. 创建签约模板
this
.
esettleSve
=
system
.
getObject
(
"service.esettleSve"
);
//
this
.
qbgconfigSve
=
system
.
getObject
(
"service.qbgconfigSve"
);
// 3. 创建企业印章
this
.
redisLock
=
system
.
getObject
(
"util.redisLock"
);
//
this
.
idcardClient
=
system
.
getObject
(
"util.idcardClient"
);
//
//
}
//
// 接口
// 静默签约
//三要素验证
// 先检查c_econtract中是否存在已签约记录(通过etemplate_id、身份证查询、eflowStatus='2'进行查询),存在直接返回成功,不存在去签必果api进行静默签
async
autoSign
(
pobj
)
{
//
// 处理参数
// 1. 个人三要素验证 - 签必果
var
param
=
{
//
ecid
:
this
.
trim
(
pobj
.
ecid
),
// 2. 创建个人账户 - 签必果
appId
:
this
.
trim
(
pobj
.
appId
),
//
userId
:
this
.
trim
(
pobj
.
userId
),
// 3. p_user和p_user_eaccount逻辑
idName
:
this
.
trim
(
pobj
.
idName
),
//
mobile
:
this
.
trim
(
pobj
.
mobile
),
// 4. 静默签 - 签必果,签约成功后记录保存到c_econtract
idNo
:
this
.
trim
(
pobj
.
idNo
),
//
bankno
:
this
.
trim
(
pobj
.
bankno
),
// 按身份证查询签约
nonceStr
:
this
.
trim
(
pobj
.
nonceStr
),
// 1. 查c_econtract和p_user_eaccount,返回签约结果
sign
:
this
.
trim
(
pobj
.
sign
)
\ No newline at end of file
};
if
(
!
param
.
ecid
)
{
return
this
.
returnjson
(
-
1
,
"请传入薪必果提供的ecid"
)
}
if
(
!
param
.
appId
)
{
return
this
.
returnjson
(
-
1
,
"请传入薪必果提供的appId"
)
}
if
(
!
param
.
userId
)
{
return
this
.
returnjson
(
-
1
,
"请提供该用户的userId"
)
}
if
(
!
param
.
idName
)
{
return
this
.
returnjson
(
-
1
,
"请提供该用户姓名"
)
}
if
(
!
param
.
idNo
)
{
return
this
.
returnjson
(
-
1
,
"请提供该用户身份证号"
)
}
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位身份证号码"
);
}
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
.
bankno
)
{
return
this
.
returnjson
(
-
1
,
"请提供该用户银行卡号"
)
}
if
(
!
param
.
nonceStr
)
{
return
this
.
returnjson
(
-
1
,
"请提供随机码"
)
}
// 查appId关联key
var
qbg
=
await
this
.
qbgconfigSve
.
findOne
({
appId
:
param
.
appId
});
if
(
!
qbg
||
!
qbg
.
key
)
{
return
this
.
returnjson
(
1001003
,
"配置信息错误,请联系薪必果人员进行配置"
);
}
// 签名
var
signArr
=
[];
var
keys
=
Object
.
keys
(
param
).
sort
();
for
(
var
i
=
0
;
i
<
keys
.
length
;
i
++
)
{
var
k
=
keys
[
i
];
var
v
=
param
[
k
];
if
(
!
k
||
!
v
||
k
==
'sign'
)
{
continue
;
}
signArr
.
push
(
k
+
"="
+
v
);
}
var
signStr
=
signArr
.
join
(
"&"
)
+
"&key="
+
qbg
.
key
;
var
sign
=
md5
(
signStr
).
toUpperCase
();
console
.
log
(
"---autoSign---签名---"
,
signStr
,
sign
);
if
(
param
.
sign
!=
sign
)
{
return
this
.
returnjson
(
1001001
,
`签名错误`
);
}
try
{
param
.
idNo
=
param
.
idNo
.
toUpperCase
();
param
.
bankno
=
param
.
bankno
.
replace
(
/
\s
*/g
,
""
);
var
key
=
param
.
idNo
+
"_"
+
param
.
ecid
const
id
=
uuidv1
();
await
this
.
redisLock
.
lock
(
key
,
id
,
20
);
var
result
=
await
this
.
qbgconfigSve
.
autoSign
(
param
,
qbg
);
await
this
.
redisLock
.
unLock
(
key
,
id
);
return
result
;
}
catch
(
error
)
{
console
.
log
(
error
);
}
}
trim
(
o
)
{
if
(
!
o
)
{
return
""
;
}
return
o
.
toString
().
trim
();
}
returnjson
(
code
,
msg
,
data
)
{
return
{
code
:
code
,
msg
:
msg
,
data
:
data
||
null
}
}
}
module
.
exports
=
GemaApi
;
bpo-web/app/base/db/impl/qbgconfigDao.js
0 → 100644
View file @
3917150f
const
system
=
require
(
"../../system"
);
const
Dao
=
require
(
"../dao.base"
);
class
QbgconfigDao
extends
Dao
{
constructor
()
{
super
(
Dao
.
getModelName
(
QbgconfigDao
));
}
}
module
.
exports
=
QbgconfigDao
;
bpo-web/app/base/db/models/qbgconfig.js
0 → 100644
View file @
3917150f
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"qbgconfig"
,
{
appid
:
DataTypes
.
STRING
,
merchant_id
:
DataTypes
.
STRING
,
seal_id
:
DataTypes
.
STRING
,
key
:
DataTypes
.
STRING
,
template_id
:
DataTypes
.
STRING
,
initiator_account
:
DataTypes
.
STRING
,
merchant_name
:
DataTypes
.
STRING
,
ecompany_id
:
DataTypes
.
INTEGER
,
},{
paranoid
:
true
,
//假的删除
underscored
:
true
,
version
:
true
,
freezeTableName
:
true
,
//freezeTableName: true,
// define the table's name
tableName
:
'qbg_config'
,
validate
:
{
},
indexes
:[
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
bpo-web/app/base/db/models/usereaccount.js
View file @
3917150f
...
@@ -9,6 +9,7 @@ module.exports = (db, DataTypes) => {
...
@@ -9,6 +9,7 @@ module.exports = (db, DataTypes) => {
eaccountid
:
DataTypes
.
STRING
,
eaccountid
:
DataTypes
.
STRING
,
bankno
:
DataTypes
.
STRING
(
30
),
bankno
:
DataTypes
.
STRING
(
30
),
email
:
DataTypes
.
STRING
(
50
),
email
:
DataTypes
.
STRING
(
50
),
esign_account
:
DataTypes
.
STRING
(
50
),
// 打零工新增字段
// 打零工新增字段
headUrl
:
DataTypes
.
STRING
(
300
),
headUrl
:
DataTypes
.
STRING
(
300
),
...
@@ -109,4 +110,4 @@ module.exports = (db, DataTypes) => {
...
@@ -109,4 +110,4 @@ module.exports = (db, DataTypes) => {
// }
// }
]
]
});
});
}
}
\ No newline at end of file
bpo-web/app/base/service/impl/qbgconfigSve.js
0 → 100644
View file @
3917150f
This diff is collapsed.
Click to expand it.
bpo-web/app/config/settings.js
View file @
3917150f
...
@@ -30,6 +30,31 @@ var settings = {
...
@@ -30,6 +30,31 @@ var settings = {
return
"http://43.247.184.94:7200/"
;
return
"http://43.247.184.94:7200/"
;
}
}
},
},
signApi
:
function
()
{
let
domain
=
''
;
if
(
this
.
env
==
"dev"
)
{
domain
=
"http://39.107.234.14:3603"
;
}
else
{
domain
=
"https://qianbiguo-api.gongsibao.com"
;
}
return
{
//三要素验证
"bankThree"
:
`
${
domain
}
/api/sign/authApi/bankThree`
,
//创个人账户
"createAccount"
:
`
${
domain
}
/api/sign/signApi/createAccount`
,
//发起签署
"autoSign"
:
`
${
domain
}
/api/sign/signApi/autoSign`
,
//创建企业模板印章
"organize"
:
`
${
domain
}
/sign/seal/create/organize`
,
//创建公司图片印章
"organizeimage"
:
`
${
domain
}
/sign/seal/create/organize/image`
,
};
},
localPath
:
function
()
{
localPath
:
function
()
{
var
os
=
require
(
"os"
);
var
os
=
require
(
"os"
);
let
platform
=
os
.
platform
()
||
""
;
let
platform
=
os
.
platform
()
||
""
;
...
...
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