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
98166452
Commit
98166452
authored
Jul 28, 2020
by
王昆
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'bpo-web' of gitlab.gongsibao.com:jiangyong/zhichan into bpo-web
parents
b3271f05
5502b1f6
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 @
98166452
...
@@ -2,7 +2,7 @@ var system = require("../../system")
...
@@ -2,7 +2,7 @@ var system = require("../../system")
const
md5
=
require
(
"md5"
);
const
md5
=
require
(
"md5"
);
const
moment
=
require
(
"moment"
);
const
moment
=
require
(
"moment"
);
const
axios
=
require
(
"axios"
);
const
axios
=
require
(
"axios"
);
const
uuidv1
=
require
(
'uuid/v1'
);
class
BpoSDPJApi
{
class
BpoSDPJApi
{
constructor
()
{
constructor
()
{
...
@@ -158,11 +158,15 @@ class BpoSDPJApi {
...
@@ -158,11 +158,15 @@ class BpoSDPJApi {
}
}
}
}
async
setNo
(
no
){
setNo
(
no
){
return
system
.
encryption
(
no
);
return
system
.
encryption
(
no
);
}
}
async
getNo
(
no
)
{
async
setNoTest
(
params
){
return
system
.
encryption
(
params
.
no
);
}
getNo
(
no
)
{
return
system
.
decryption
(
no
);
return
system
.
decryption
(
no
);
}
}
...
@@ -232,12 +236,23 @@ class BpoSDPJApi {
...
@@ -232,12 +236,23 @@ class BpoSDPJApi {
outTradeNo
:
this
.
trim
(
obj
.
outTradeNo
),
outTradeNo
:
this
.
trim
(
obj
.
outTradeNo
),
mchtId
:
this
.
trim
(
obj
.
mchtId
),
mchtId
:
this
.
trim
(
obj
.
mchtId
),
});
});
return
this
.
getCodeResult
(
0
,
{
let
resData
=
{
id_name
:
_cCashInfo
.
id_name
,
id_name
:
_cCashInfo
.
id_name
,
id_no
:
_cCashInfo
.
id_no
,
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
)
{
}
catch
(
e
)
{
console
.
log
(
e
);
console
.
log
(
e
);
let
result
=
{
let
result
=
{
...
@@ -289,16 +304,16 @@ class BpoSDPJApi {
...
@@ -289,16 +304,16 @@ class BpoSDPJApi {
/**
/**
* TODO:需要线上测试
* 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
});
//
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
)
{
//
if (doAuthRes.status !== 0) {
return
this
.
getBaseResult
(
1
,
doAuthRes
.
msg
||
"姓名或身份证错误"
);
//
return this.getBaseResult(1, doAuthRes.msg || "姓名或身份证错误");
}
//
}
ccashinfo
.
id_name
=
this
.
trim
(
obj
.
id_name
);
ccashinfo
.
id_name
=
this
.
trim
(
obj
.
id_name
);
ccashinfo
.
id_no
=
this
.
trim
(
obj
.
id_no
);
ccashinfo
.
id_no
=
this
.
trim
(
obj
.
id_no
);
await
ccashinfo
.
save
();
await
ccashinfo
.
save
();
console
.
log
(
"调用二要素 (兰伯望) 接口返回:"
+
JSON
.
stringify
(
doAuthRes
));
//
console.log("调用二要素 (兰伯望) 接口返回:"+JSON.stringify(doAuthRes));
this
.
doSign3
(
ccashinfo
);
//
this.doSign3(ccashinfo);
return
this
.
getBaseResult
(
0
,
msg
=
"认证成功"
,
data
=
{
no
:
this
.
setNo
(
ccashinfo
.
id
),
amt
:
system
.
f2y
(
ccashinfo
.
amt
),
mchtId
:
ccashinfo
.
mchtId
})
;
return
{
code
:
0
,
msg
:
"认证成功"
,
data
:{
amt
:
system
.
f2y
(
ccashinfo
.
amt
),
mchtId
:
ccashinfo
.
mchtId
}}
;
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
e
);
console
.
log
(
e
);
let
result
=
{
let
result
=
{
...
@@ -318,6 +333,9 @@ class BpoSDPJApi {
...
@@ -318,6 +333,9 @@ class BpoSDPJApi {
if
(
!
obj
.
no
){
if
(
!
obj
.
no
){
return
this
.
getBaseResult
(
1
,
'ID不能为空'
);
return
this
.
getBaseResult
(
1
,
'ID不能为空'
);
}
}
let
ccashinfo
=
await
this
.
ccashinfoSve
.
getBean
({
id
:
this
.
getNo
(
obj
.
no
)
});
let
key
=
`SDPJ_CASH_
${
ccashinfo
.
id
}
`
;
let
key
=
`SDPJ_CASH_
${
ccashinfo
.
id
}
`
;
let
_lock
=
uuidv1
();
let
_lock
=
uuidv1
();
try
{
try
{
...
@@ -332,12 +350,13 @@ class BpoSDPJApi {
...
@@ -332,12 +350,13 @@ class BpoSDPJApi {
return
this
.
getErrResult
(
"二维码已作废,禁止提现"
);
return
this
.
getErrResult
(
"二维码已作废,禁止提现"
);
}
}
if
(
ccashinfo
.
trade_status
!=
"00"
)
{
if
(
ccashinfo
.
trade_status
)
{
return
this
.
getErrResult
(
"已提现,不要重复提现"
);
return
this
.
getErrResult
(
"已提现,不要重复提现"
);
}
}
await
this
.
redisLock
.
lock
(
key
,
_lock
,
20
);
await
this
.
redisLock
.
lock
(
key
,
_lock
,
20
);
let
result
=
await
this
.
cashOut
(
ccashinfo
);
let
result
=
await
this
.
cashOut
(
ccashinfo
);
return
result
;
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
e
);
console
.
log
(
e
);
let
result
=
{
let
result
=
{
...
@@ -482,7 +501,7 @@ class BpoSDPJApi {
...
@@ -482,7 +501,7 @@ class BpoSDPJApi {
return
this
.
getBaseResult
(
1
,
msg
);
return
this
.
getBaseResult
(
1
,
msg
);
}
}
getBaseResult
(
code
=
0
,
msg
=
""
,
data
=
{}
)
{
getBaseResult
(
code
,
msg
,
data
)
{
let
res
=
{
let
res
=
{
"code"
:
code
,
"code"
:
code
,
"msg"
:
msg
,
"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