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
5502b1f6
Commit
5502b1f6
authored
Jul 28, 2020
by
孙亚楠
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
8e1d3ac7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
16 deletions
+35
-16
bpo-web/app/base/api/impl/bpoSDPJApi.js
+35
-16
No files found.
bpo-web/app/base/api/impl/bpoSDPJApi.js
View file @
5502b1f6
...
...
@@ -2,7 +2,7 @@ var system = require("../../system")
const
md5
=
require
(
"md5"
);
const
moment
=
require
(
"moment"
);
const
axios
=
require
(
"axios"
);
const
uuidv1
=
require
(
'uuid/v1'
);
class
BpoSDPJApi
{
constructor
()
{
...
...
@@ -158,11 +158,15 @@ class BpoSDPJApi {
}
}
async
setNo
(
no
){
setNo
(
no
){
return
system
.
encryption
(
no
);
}
async
getNo
(
no
)
{
async
setNoTest
(
params
){
return
system
.
encryption
(
params
.
no
);
}
getNo
(
no
)
{
return
system
.
decryption
(
no
);
}
...
...
@@ -229,12 +233,23 @@ class BpoSDPJApi {
outTradeNo
:
this
.
trim
(
obj
.
outTradeNo
),
mchtId
:
this
.
trim
(
obj
.
mchtId
),
});
return
this
.
getCodeResult
(
0
,
{
let
resData
=
{
id_name
:
_cCashInfo
.
id_name
,
id_no
:
_cCashInfo
.
id_no
,
// app_id: _cCashInfo.app_id,
no
:
this
.
setNo
(
_cCashInfo
.
id
)
})
};
//判断用户是否提现过 交易状态 00 成功 01 待处理 02 失败
if
(
!
_cCashInfo
.
trade_status
){
resData
.
redirectCode
=
1
;
//跳转到认证
}
else
{
resData
.
redirect_code
=
2
;
//跳转到领取结果
resData
.
trade_status
=
_cCashInfo
.
trade_status
;
if
(
resData
.
trade_status
==
"00"
){
_cCashInfo
.
amt
=
system
.
f2y
(
_cCashInfo
.
amt
);
}
else
if
(
resData
.
trade_status
==
"02"
){
_cCashInfo
.
failReason
=
""
;
}
}
return
this
.
getCodeResult
(
0
,
resData
);
}
catch
(
e
)
{
console
.
log
(
e
);
let
result
=
{
...
...
@@ -286,16 +301,16 @@ class BpoSDPJApi {
/**
* TODO:需要线上测试
*/
let
doAuthRes
=
await
this
.
doAuth
({
id_name
:
this
.
trim
(
obj
.
id_name
),
id_no
:
this
.
trim
(
obj
.
id_no
),
app_id
:
obj
.
app_id
});
if
(
doAuthRes
.
status
!==
0
)
{
return
this
.
getBaseResult
(
1
,
doAuthRes
.
msg
||
"姓名或身份证错误"
);
}
//
let doAuthRes =await this.doAuth({id_name:this.trim(obj.id_name),id_no:this.trim(obj.id_no), app_id:obj.app_id});
//
if (doAuthRes.status !== 0) {
//
return this.getBaseResult(1, doAuthRes.msg || "姓名或身份证错误");
//
}
ccashinfo
.
id_name
=
this
.
trim
(
obj
.
id_name
);
ccashinfo
.
id_no
=
this
.
trim
(
obj
.
id_no
);
await
ccashinfo
.
save
();
console
.
log
(
"调用二要素 (兰伯望) 接口返回:"
+
JSON
.
stringify
(
doAuthRes
));
this
.
doSign3
(
ccashinfo
);
return
this
.
getBaseResult
(
0
,
msg
=
"认证成功"
,
data
=
{
no
:
this
.
setNo
(
ccashinfo
.
id
),
amt
:
system
.
f2y
(
ccashinfo
.
amt
),
mchtId
:
ccashinfo
.
mchtId
})
;
//
console.log("调用二要素 (兰伯望) 接口返回:"+JSON.stringify(doAuthRes));
//
this.doSign3(ccashinfo);
return
{
code
:
0
,
msg
:
"认证成功"
,
data
:{
amt
:
system
.
f2y
(
ccashinfo
.
amt
),
mchtId
:
ccashinfo
.
mchtId
}}
;
}
catch
(
e
)
{
console
.
log
(
e
);
let
result
=
{
...
...
@@ -315,6 +330,9 @@ class BpoSDPJApi {
if
(
!
obj
.
no
){
return
this
.
getBaseResult
(
1
,
'ID不能为空'
);
}
let
ccashinfo
=
await
this
.
ccashinfoSve
.
getBean
({
id
:
this
.
getNo
(
obj
.
no
)
});
let
key
=
`SDPJ_CASH_
${
ccashinfo
.
id
}
`
;
let
_lock
=
uuidv1
();
try
{
...
...
@@ -329,12 +347,13 @@ class BpoSDPJApi {
return
this
.
getErrResult
(
"二维码已作废,禁止提现"
);
}
if
(
ccashinfo
.
trade_status
!=
"00"
)
{
if
(
ccashinfo
.
trade_status
)
{
return
this
.
getErrResult
(
"已提现,不要重复提现"
);
}
await
this
.
redisLock
.
lock
(
key
,
_lock
,
20
);
let
result
=
await
this
.
cashOut
(
ccashinfo
);
return
result
;
}
catch
(
e
)
{
console
.
log
(
e
);
let
result
=
{
...
...
@@ -479,7 +498,7 @@ class BpoSDPJApi {
return
this
.
getBaseResult
(
1
,
msg
);
}
getBaseResult
(
code
=
0
,
msg
=
""
,
data
=
{}
)
{
getBaseResult
(
code
,
msg
,
data
)
{
let
res
=
{
"code"
:
code
,
"msg"
:
msg
,
...
...
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