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
daf2234b
Commit
daf2234b
authored
Jul 27, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
684e610d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
26 deletions
+33
-26
bpo-web/app/base/api/impl/bpoSDPJApi.js
+33
-26
No files found.
bpo-web/app/base/api/impl/bpoSDPJApi.js
View file @
daf2234b
...
...
@@ -29,7 +29,8 @@ class BpoSDPJApi {
this
.
idcardClient
=
system
.
getObject
(
"util.idcardClient"
);
this
.
esettleSve
=
system
.
getObject
(
"service.esettleSve"
);
this
.
tdevApi
=
require
(
"./tdevApi"
);
let
resultMap
=
{
this
.
redisLock
=
system
.
getObject
(
"util.redisLock"
);
this
.
resultMap
=
{
0
:
"操作成功"
,
1
:
"操作失败"
,
1001001
:
"签名失败"
,
...
...
@@ -79,17 +80,17 @@ class BpoSDPJApi {
// }
try
{
if
(
!
obj
||
!
obj
.
outTradeNo
||
!
obj
.
mchtId
){
return
this
.
getResult
(
1002001
,
null
);
return
this
.
get
Code
Result
(
1002001
,
null
);
}
//1.mchtId & ecid 进行联合查询 如果存在直接返回
let
_cCashInfo
=
await
this
.
ccashinfoSve
.
getBean
(
obj
);
console
.
log
(
`bpoSDPJApi.js -> cashQRCode -> mchtId & ecid 进行联合查询 :参数=`
+
JSON
.
stringify
(
obj
)
+
" _cCashInfo = "
+
JSON
.
stringify
(
_cCashInfo
));
if
(
_cCashInfo
){
return
this
.
getResult
(
1002001
,
null
);
return
this
.
get
Code
Result
(
1002001
,
null
);
}
//2.检验所有参数是否完整 如果出现非法参数直接返回
if
(
!
obj
.
ecid
||
!
obj
.
appId
||!
obj
.
idNo
||
!
obj
.
idName
||
!
obj
.
amt
){
return
this
.
getResult
(
1002001
,
null
);
return
this
.
get
Code
Result
(
1002001
,
null
);
}
//3.获取签约类型
let
_ecompanybusi
=
await
this
.
ecompanybusiSve
.
findOneByAppidMchtId
({
...
...
@@ -98,7 +99,7 @@ class BpoSDPJApi {
});
console
.
log
(
"查看签约类型 _ecompanybusi="
+
JSON
.
stringify
(
_ecompanybusi
));
if
(
!
_ecompanybusi
||
!
_ecompanybusi
.
hasOwnProperty
(
"app_type"
)){
return
this
.
getResult
(
500
,
null
);
return
this
.
get
Code
Result
(
500
,
null
);
}
let
_ccashinfoProperty
=
{};
...
...
@@ -114,14 +115,14 @@ class BpoSDPJApi {
//4.保存签约数据
_cCashInfo
=
await
this
.
ccashinfoSve
.
save
(
_ccashinfoProperty
);
if
(
!
_cCashInfo
){
return
this
.
getResult
(
500
,
null
);
return
this
.
get
Code
Result
(
500
,
null
);
}
//5. 拼接h5 http连接 http//xxx?mchtId=xxx&ecid=xxx&no=id
let
_no
=
await
this
.
setNo
(
_cCashInfo
.
id
);
let
custormUrl
=
`http://bpohhr.gongsibao.com?no=
${
_no
}
&outTradeNo=
${
_cCashInfo
.
outTradeNo
}
&mchtId=
${
_cCashInfo
.
mchtId
}
`
;
//6.生成二维码
let
url
=
await
this
.
qrClient
.
generateQR
(
custormUrl
);
return
this
.
getResult
(
0
,{
"qrcode"
:
url
||
""
});
return
this
.
get
Code
Result
(
0
,{
"qrcode"
:
url
||
""
});
}
catch
(
e
)
{
let
result
=
{
code
:
500
,
...
...
@@ -146,7 +147,7 @@ class BpoSDPJApi {
*/
async
verificationMtchOutTradeNo
(
obj
,
req
){
if
(
!
obj
||
!
obj
.
outTradeNo
||
!
obj
.
mchtId
||
!
obj
.
no
){
return
this
.
getResult
(
1002001
,
null
);
return
this
.
get
Code
Result
(
1002001
,
null
);
}
let
no
=
await
this
.
getNo
(
obj
.
no
);
try
{
...
...
@@ -155,7 +156,7 @@ class BpoSDPJApi {
outTradeNo
:
this
.
trim
(
obj
.
outTradeNo
),
mchtId
:
this
.
trim
(
obj
.
mchtId
),
});
return
this
.
getResult
(
0
,{
return
this
.
get
Code
Result
(
0
,{
id_name
:
_cCashInfo
.
id_name
,
id_no
:
_cCashInfo
.
id_no
,
app_id
:
_cCashInfo
.
app_id
,
...
...
@@ -178,7 +179,7 @@ class BpoSDPJApi {
*/
async
authentication
(
obj
,
req
){
if
(
!
obj
||
!
obj
.
id_name
||
!
obj
.
id_no
||
!
obj
.
mchtId
||
!
obj
.
app_id
||
!
obj
.
id
){
return
this
.
getResult
(
1002001
,
null
);
return
this
.
get
Code
Result
(
1002001
,
null
);
}
try
{
if
(
!
await
this
.
idcardClient
.
checkIDCard
(
obj
.
id_no
))
{
...
...
@@ -249,13 +250,13 @@ class BpoSDPJApi {
}
async
doAuth
(
params
,
api
)
{
async
doAuth
(
cashInfo
)
{
let
res
;
// 姓名二要素
res
=
await
this
.
bankthreelogSve
.
personTwo
({
appId
:
"sdpj_sign_"
+
api
.
app_id
,
userName
:
params
.
idN
ame
,
userIdNo
:
params
.
idN
o
appId
:
"sdpj_sign_"
+
cashInfo
.
app_id
,
userName
:
cashInfo
.
id_n
ame
,
userIdNo
:
cashInfo
.
id_n
o
});
return
res
;
}
...
...
@@ -290,7 +291,7 @@ class BpoSDPJApi {
"note"
:
"提现"
,
"idType"
:
"00"
,
"idName"
:
cashInfo
.
id_name
,
"seqNo"
:
cashInfo
.
id
,
"seqNo"
:
"1000"
,
"accNo"
:
cashInfo
.
openId
,
"amt"
:
cashInfo
.
amt
,
"accType"
:
"00"
,
...
...
@@ -299,7 +300,7 @@ class BpoSDPJApi {
let
nonceStr
=
await
this
.
getUidStr
(
32
,
36
);
let
tradeTime
=
moment
().
format
(
'YYYYMMDDHHmmss'
);
var
param
=
{
"appId"
:
cashInfo
.
app
I
d
,
"appId"
:
cashInfo
.
app
_i
d
,
"currency"
:
"CNY"
,
"mchtId"
:
cashInfo
.
mchtId
,
"nonceStr"
:
nonceStr
,
...
...
@@ -331,11 +332,10 @@ class BpoSDPJApi {
data
:
param
,
});
if
(
rs
.
data
.
code
===
0
)
{
trade
.
trade_status
=
"00"
;
return
system
.
getResult2
(
"提现成功"
);
return
this
.
getSuccessResult
(
"提现成功"
);
}
console
.
log
(
rs
.
data
);
return
system
.
getErrResult2
(
rs
.
data
.
msg
);
return
this
.
getCodeResult
(
rs
.
data
.
msg
);
}
catch
(
error
)
{
console
.
log
(
error
);
// 发起失败,删除trade
...
...
@@ -363,17 +363,24 @@ class BpoSDPJApi {
return
uuid
.
join
(
''
);
}
getResult
(
code
,
data
=
{},
other
=
{}){
getSuccessResult
(
msg
=
"success"
,
data
=
{})
{
return
this
.
getBaseResult
(
0
,
msg
,
data
);
}
getCodeResult
(
code
,
data
=
{}){
return
this
.
getBaseResult
(
code
,
this
.
resultMap
[
code
],
data
);
}
getErrResult
(
msg
){
return
this
.
getBaseResult
(
1
,
msg
);
}
getBaseResult
(
code
=
0
,
msg
=
""
,
data
=
{})
{
let
res
=
{
"code"
:
code
,
"msg"
:
this
.
resultMap
[
code
]
||
""
,
"msg"
:
msg
,
"data"
:
data
}
for
(
let
ele
in
other
)
{
res
[
ele
]
=
other
[
ele
];
}
return
res
;
}
}
module
.
exports
=
BpoSDPJApi
;
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