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
8e1d3ac7
Commit
8e1d3ac7
authored
Jul 28, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
c4ed4688
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
89 additions
and
7 deletions
+89
-7
bpo-web/app/base/api/impl/bpoSDPJApi.js
+70
-7
bpo-web/app/base/system.js
+19
-0
No files found.
bpo-web/app/base/api/impl/bpoSDPJApi.js
View file @
8e1d3ac7
...
...
@@ -159,11 +159,59 @@ class BpoSDPJApi {
}
async
setNo
(
no
){
return
no
;
return
system
.
encryption
(
no
)
;
}
async
getNo
(
no
)
{
return
no
;
return
system
.
decryption
(
no
);
}
/**
* 二维码作废
* @param obj
* @param req
* @returns {Promise<{msg: string, code: number, data: {}}>}
*/
async
removeQRCode
(
obj
,
req
)
{
try
{
let
params
=
{
appId
:
obj
.
appId
,
mchtId
:
obj
.
mchtId
,
ecid
:
obj
.
ecid
,
outTradeNo
:
obj
.
outTradeNo
,
nonceStr
:
obj
.
nonceStr
,
sign
:
obj
.
sign
,
};
let
api
=
await
this
.
ecompanybusiSve
.
findOne
({
appId
:
obj
.
appId
,
etemplate_id
:
obj
.
ecid
,
mchtId
:
obj
.
mchtId
,
});
if
(
!
api
)
{
return
this
.
getBaseResult
(
1001003
,
"配置信息错误,请联系薪必果人员进行配置"
);
}
let
sign
=
system
.
getSign
(
params
,
api
.
key
,
this
.
EXCEPT_KEYS
);
if
(
obj
.
sign
!=
sign
)
{
return
this
.
getBaseResult
(
1001001
,
"签名失败"
);
}
let
cashInfo
=
await
this
.
ccashinfoSve
.
findOne
({
mchtId
:
params
.
mchtId
,
outTradeNo
:
params
.
outTradeNo
,
});
if
(
!
cashInfo
)
{
return
this
.
getErrResult
(
"二维码不存在"
);
}
cashInfo
.
qrcode_status
=
2
;
await
cashInfo
.
save
();
}
catch
(
e
)
{
console
.
log
(
e
);
return
this
.
getErrResult
(
"接口异常"
);
}
return
this
.
getSuccessResult
();
}
/**
...
...
@@ -203,12 +251,13 @@ class BpoSDPJApi {
* @returns {Promise<void>}
*/
async
authentication
(
obj
,
req
){
if
(
!
obj
||
!
obj
.
id_name
||
!
obj
.
id_no
||
!
obj
.
no
){
if
(
!
obj
||
!
obj
.
id_name
||
!
obj
.
id_no
||
!
obj
.
no
||
!
obj
.
openId
){
return
this
.
getCodeResult
(
1002001
,
null
);
}
let
id
=
this
.
getNo
(
obj
.
no
);
try
{
let
ccashinfo
=
await
this
.
ccashinfoSve
.
getBean
({
id
:
this
.
getNo
(
obj
.
no
)
id
:
id
});
if
(
!
ccashinfo
){
this
.
getErrResult
(
"信息不存在"
);
...
...
@@ -266,15 +315,27 @@ class BpoSDPJApi {
if
(
!
obj
.
no
){
return
this
.
getBaseResult
(
1
,
'ID不能为空'
);
}
let
key
=
`SDPJ_CASH_
${
ccashinfo
.
id
}
`
;
let
_lock
=
uuidv1
();
try
{
let
ccashinfo
=
await
this
.
ccashinfoSve
.
getBean
({
id
:
this
.
getNo
(
obj
.
no
)
});
if
(
!
ccashinfo
){
this
.
getErrResult
(
"信息不存在"
);
return
this
.
getErrResult
(
"信息不存在"
);
}
return
await
this
.
cashOut
(
ccashinfo
);
}
catch
(
e
)
{
if
(
ccashinfo
.
qrcode_status
!=
1
)
{
return
this
.
getErrResult
(
"二维码已作废,禁止提现"
);
}
if
(
ccashinfo
.
trade_status
!=
"00"
)
{
return
this
.
getErrResult
(
"已提现,不要重复提现"
);
}
await
this
.
redisLock
.
lock
(
key
,
_lock
,
20
);
let
result
=
await
this
.
cashOut
(
ccashinfo
);
}
catch
(
e
)
{
console
.
log
(
e
);
let
result
=
{
code
:
500
,
...
...
@@ -282,6 +343,8 @@ class BpoSDPJApi {
};
console
.
log
(
e
.
stack
);
return
result
;
}
finally
{
await
this
.
redisLock
.
unLock
(
key
,
_lock
);
}
}
...
...
bpo-web/app/base/system.js
View file @
8e1d3ac7
...
...
@@ -2,6 +2,7 @@ var fs=require("fs");
var
objsettings
=
require
(
"../config/objsettings"
);
var
settings
=
require
(
"../config/settings"
);
const
crypto
=
require
(
'crypto'
);
const
md5
=
require
(
'md5'
);
class
System
{
static
declare
(
ns
)
{
...
...
@@ -267,6 +268,24 @@ class System {
cipherChunks
.
push
(
decipher
.
final
(
'utf8'
));
return
cipherChunks
.
join
(
''
);
}
static
getSign
(
params
,
secret
,
exceptKeys
=
[])
{
console
.
log
(
"---------签名参数-----------"
,
params
,
secret
,
exceptKeys
);
let
keys
=
Object
.
keys
(
params
).
sort
();
let
signArr
=
[];
for
(
let
k
=
0
;
k
<
keys
.
length
;
k
++
)
{
let
tKey
=
keys
[
k
];
if
(
exceptKeys
.
indexOf
(
tKey
)
==
-
1
&&
params
[
tKey
])
{
signArr
.
push
(
tKey
+
"="
+
params
[
tKey
]);
}
}
let
signStr
=
signArr
.
join
(
"&"
)
+
"&key="
+
secret
;
let
sign
=
md5
(
signStr
).
toUpperCase
();
console
.
log
(
"---------签名结果-----------"
,
signStr
,
sign
);
return
sign
;
}
// static buildObjectFactory(){
// for(var k in objsettings){
// let classpath=objsettings[k];
...
...
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