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
684e610d
Commit
684e610d
authored
Jul 27, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
b78c4499
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
114 additions
and
4 deletions
+114
-4
bpo-web/app/base/api/impl/bpoSDPJApi.js
+114
-4
No files found.
bpo-web/app/base/api/impl/bpoSDPJApi.js
View file @
684e610d
var
system
=
require
(
"../../system"
)
const
md5
=
require
(
"md5"
);
const
moment
=
require
(
"moment"
);
const
axios
=
require
(
"axios"
);
class
BpoSDPJApi
{
constructor
()
{
...
...
@@ -34,10 +36,6 @@ class BpoSDPJApi {
1002001
:
"参数错误"
,
500
:
"接口异常"
,
}
}
trim
(
o
)
{
if
(
!
o
)
{
...
...
@@ -251,7 +249,119 @@ class BpoSDPJApi {
}
async
doAuth
(
params
,
api
)
{
let
res
;
// 姓名二要素
res
=
await
this
.
bankthreelogSve
.
personTwo
({
appId
:
"sdpj_sign_"
+
api
.
app_id
,
userName
:
params
.
idName
,
userIdNo
:
params
.
idNo
});
return
res
;
}
async
doSign3
(
cashInfo
,
params
)
{
let
result
;
// 专票签(三方签)
let
signParam
=
{
ecid
:
this
.
trim
(
cashInfo
.
ecid
),
appId
:
this
.
trim
(
cashInfo
.
app_id
),
userId
:
this
.
trim
(
cashInfo
.
id_no
),
idName
:
this
.
trim
(
cashInfo
.
id_name
),
idNo
:
this
.
trim
(
cashInfo
.
id_no
),
};
try
{
let
key
=
`
${
cashInfo
.
mcthId
}
_
${
cashInfo
.
outTradeNo
}
`
;
let
id
=
uuidv1
();
await
this
.
redisLock
.
lock
(
key
,
id
,
20
);
let
result
=
await
this
.
econtractSve
.
autoSignBankTwo
(
param
);
await
this
.
redisLock
.
unLock
(
key
,
id
);
return
result
;
}
catch
(
e
)
{
console
.
log
(
e
,
cashInfo
,
"-----------------------签约异常-----------------------"
);
return
{
code
:
1
,
msg
:
"签约异常"
};
}
}
async
cashOut
(
cashInfo
)
{
// 发起交易
let
bizContent
=
[];
bizContent
.
push
({
"note"
:
"提现"
,
"idType"
:
"00"
,
"idName"
:
cashInfo
.
id_name
,
"seqNo"
:
cashInfo
.
id
,
"accNo"
:
cashInfo
.
openId
,
"amt"
:
cashInfo
.
amt
,
"accType"
:
"00"
,
"idNo"
:
cashInfo
.
id_no
});
let
nonceStr
=
await
this
.
getUidStr
(
32
,
36
);
let
tradeTime
=
moment
().
format
(
'YYYYMMDDHHmmss'
);
var
param
=
{
"appId"
:
cashInfo
.
appId
,
"currency"
:
"CNY"
,
"mchtId"
:
cashInfo
.
mchtId
,
"nonceStr"
:
nonceStr
,
"notityUrl"
:
"https://bpohhr.gongsibao.com/api/econtractApi/transferNotify"
,
"outTradeNo"
:
cashInfo
.
outTradeNo
,
"signType"
:
"MD5"
,
"tradeTime"
:
tradeTime
,
"bizContent"
:
bizContent
,
}
// now
let
signArr
=
[];
signArr
.
push
(
"appId="
+
param
.
appId
);
signArr
.
push
(
"currency="
+
param
.
currency
);
signArr
.
push
(
"mchtId="
+
param
.
mchtId
);
signArr
.
push
(
"nonceStr="
+
param
.
nonceStr
);
signArr
.
push
(
"notityUrl="
+
param
.
notityUrl
);
signArr
.
push
(
"outTradeNo="
+
param
.
outTradeNo
);
signArr
.
push
(
"signType="
+
param
.
signType
);
signArr
.
push
(
"tradeTime="
+
param
.
tradeTime
);
signArr
.
push
(
"key="
+
mcht
.
secret
);
param
.
sign
=
md5
(
signArr
.
join
(
"&"
)).
toUpperCase
();
console
.
log
(
JSON
.
stringify
(
param
));
try
{
let
rs
=
await
axios
({
method
:
'post'
,
url
:
"https://pay.gongsibao.com/merchant/order/transfer"
,
data
:
param
,
});
if
(
rs
.
data
.
code
===
0
)
{
trade
.
trade_status
=
"00"
;
return
system
.
getResult2
(
"提现成功"
);
}
console
.
log
(
rs
.
data
);
return
system
.
getErrResult2
(
rs
.
data
.
msg
);
}
catch
(
error
)
{
console
.
log
(
error
);
// 发起失败,删除trade
}
}
async
getUidStr
(
len
,
radix
)
{
var
chars
=
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
.
split
(
''
);
var
uuid
=
[],
i
;
radix
=
radix
||
chars
.
length
;
if
(
len
)
{
for
(
i
=
0
;
i
<
len
;
i
++
)
uuid
[
i
]
=
chars
[
0
|
Math
.
random
()
*
radix
];
}
else
{
var
r
;
uuid
[
8
]
=
uuid
[
13
]
=
uuid
[
18
]
=
uuid
[
23
]
=
'-'
;
uuid
[
14
]
=
'4'
;
for
(
i
=
0
;
i
<
36
;
i
++
)
{
if
(
!
uuid
[
i
])
{
r
=
0
|
Math
.
random
()
*
16
;
uuid
[
i
]
=
chars
[(
i
==
19
)
?
(
r
&
0x3
)
|
0x8
:
r
];
}
}
}
return
uuid
.
join
(
''
);
}
getResult
(
code
,
data
=
{},
other
=
{}){
let
res
=
{
...
...
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