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
41f69487
Commit
41f69487
authored
Jul 31, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
216dfc62
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
222 additions
and
95 deletions
+222
-95
bpo-web/app/base/api/impl/bpoSDPJApi.js
+137
-95
bpo-web/app/base/db/impl/ccashuserDao.js
+16
-0
bpo-web/app/base/db/models/ccashuser.js
+53
-0
bpo-web/app/base/service/impl/ccashinfoSve.js
+2
-0
bpo-web/app/base/service/impl/ccashuserSve.js
+14
-0
No files found.
bpo-web/app/base/api/impl/bpoSDPJApi.js
View file @
41f69487
...
...
@@ -4,6 +4,7 @@ const md5 = require("md5");
const
moment
=
require
(
"moment"
);
const
axios
=
require
(
"axios"
);
const
uuidv1
=
require
(
'uuid/v1'
);
class
BpoSDPJApi
{
constructor
()
{
...
...
@@ -25,6 +26,7 @@ class BpoSDPJApi {
this
.
EXCEPT_KEYS
=
[
'sign'
];
this
.
ccashinfoSve
=
system
.
getObject
(
"service.ccashinfoSve"
);
this
.
ccashuserSve
=
system
.
getObject
(
"service.ccashuserSve"
);
this
.
ecompanybusiDao
=
system
.
getObject
(
"db.ecompanybusiDao"
);
this
.
qrClient
=
system
.
getObject
(
"util.qrClient"
);
this
.
idcardClient
=
system
.
getObject
(
"util.idcardClient"
);
...
...
@@ -37,15 +39,16 @@ class BpoSDPJApi {
this
.
bankthreelogSve
=
system
.
getObject
(
"service.bankthreelogSve"
);
this
.
etemplateSve
=
system
.
getObject
(
"service.etemplateSve"
)
this
.
resultMap
=
{
0
:
"操作成功"
,
1
:
"操作失败"
,
1001001
:
"签名失败"
,
1002001
:
"参数错误"
,
500
:
"接口异常"
,
0
:
"操作成功"
,
1
:
"操作失败"
,
1001001
:
"签名失败"
,
1002001
:
"参数错误"
,
500
:
"接口异常"
,
}
}
trim
(
o
)
{
if
(
!
o
)
{
if
(
!
o
)
{
return
""
;
}
return
o
.
toString
().
trim
();
...
...
@@ -75,27 +78,27 @@ class BpoSDPJApi {
async
cashQRCode
(
obj
,
req
)
{
// 检验所有参数是否完整 如果出现非法参数直接返回
if
(
!
obj
.
appId
)
{
return
this
.
getBaseResult
(
1002001
,
"appId不存在"
);
return
this
.
getBaseResult
(
1002001
,
"appId不存在"
);
}
if
(
!
obj
.
mchtId
)
{
return
this
.
getBaseResult
(
1002001
,
"mchtId不存在"
);
return
this
.
getBaseResult
(
1002001
,
"mchtId不存在"
);
}
if
(
!
obj
.
outTradeNo
)
{
return
this
.
getBaseResult
(
1002001
,
"商户订单号[outTradeNo]不存在"
);
return
this
.
getBaseResult
(
1002001
,
"商户订单号[outTradeNo]不存在"
);
}
if
(
!
obj
.
notifyUrl
)
{
return
this
.
getBaseResult
(
1002001
,
"商户订单号[notifyUrl]不存在"
);
return
this
.
getBaseResult
(
1002001
,
"商户订单号[notifyUrl]不存在"
);
}
let
otnLen
=
this
.
trim
(
obj
.
outTradeNo
).
length
;
if
(
otnLen
<
10
||
otnLen
>
32
)
{
return
this
.
getBaseResult
(
1002001
,
"商户订单号[outTradeNo]长度10-32"
);
return
this
.
getBaseResult
(
1002001
,
"商户订单号[outTradeNo]长度10-32"
);
}
if
(
!
obj
.
amt
)
{
return
this
.
getBaseResult
(
1002001
,
"请设置申请金额"
);
return
this
.
getBaseResult
(
1002001
,
"请设置申请金额"
);
}
if
(
!
obj
.
ecid
)
{
return
this
.
getBaseResult
(
1002001
,
"ecid不存在"
);
return
this
.
getBaseResult
(
1002001
,
"ecid不存在"
);
}
// 获取api信息
...
...
@@ -135,8 +138,8 @@ class BpoSDPJApi {
console
.
log
(
`bpoSDPJApi.js -> cashQRCode -> mchtId & ecid 进行联合查询 :参数=`
+
JSON
.
stringify
(
obj
)
+
" _cCashInfo = "
+
JSON
.
stringify
(
_cCashInfo
));
//如果二维码有效直接返回
if
(
_cCashInfo
.
qrcode_status
&&
_cCashInfo
.
qrcode
)
{
return
this
.
getCodeResult
(
0
,{
"qrcode"
:
_cCashInfo
.
qrcode
});
if
(
_cCashInfo
.
qrcode_status
&&
_cCashInfo
.
qrcode
)
{
return
this
.
getCodeResult
(
0
,
{
"qrcode"
:
_cCashInfo
.
qrcode
});
}
if
(
!
_cCashInfo
.
id
)
{
...
...
@@ -147,7 +150,7 @@ class BpoSDPJApi {
_cCashInfo
.
app_id
=
obj
.
appId
;
_cCashInfo
.
amt
=
Number
(
obj
.
amt
||
0
);
_cCashInfo
.
idName
=
this
.
trim
(
obj
.
idName
)
||
""
;
_cCashInfo
.
idNo
=
this
.
trim
(
obj
.
idNo
)
||
""
;
_cCashInfo
.
idNo
=
this
.
trim
(
obj
.
idNo
)
||
""
;
_cCashInfo
.
notify_url
=
this
.
trim
(
obj
.
notifyUrl
)
||
""
;
// 保存签约数据
_cCashInfo
=
await
this
.
ccashinfoSve
.
create
(
_cCashInfo
);
...
...
@@ -158,12 +161,12 @@ class BpoSDPJApi {
_no
=
encodeURIComponent
(
_no
);
let
custormUrl
=
`https://bpohhr.gongsibao.com/sdpj?no=
${
_no
}
&outTradeNo=
${
_cCashInfo
.
outTradeNo
}
&mchtId=
${
_cCashInfo
.
mchtId
}
`
;
// 生成二维码
let
url
=
await
this
.
qrClient
.
generateQR
(
custormUrl
);
let
url
=
await
this
.
qrClient
.
generateQR
(
custormUrl
);
_cCashInfo
.
qrcode
=
url
;
_cCashInfo
.
qrcode_status
=
url
?
1
:
2
;
_cCashInfo
.
sign_url
=
custormUrl
;
_cCashInfo
.
save
();
return
this
.
getCodeResult
(
0
,{
"qrcode"
:
url
||
""
});
return
this
.
getCodeResult
(
0
,
{
"qrcode"
:
url
||
""
});
}
catch
(
e
)
{
let
result
=
{
code
:
500
,
...
...
@@ -174,11 +177,11 @@ class BpoSDPJApi {
}
}
setNo
(
no
){
setNo
(
no
)
{
return
system
.
encryption
(
no
);
}
async
setNoTest
(
params
){
async
setNoTest
(
params
)
{
return
system
.
encryption
(
params
.
no
);
}
...
...
@@ -243,31 +246,46 @@ class BpoSDPJApi {
* fn:验证商户是否可用
* @returns {Promise<void>}
*/
async
verificationMtchOutTradeNo
(
obj
,
req
){
if
(
!
obj
||
!
obj
.
outTradeNo
||
!
obj
.
mchtId
||
!
obj
.
no
)
{
return
this
.
getCodeResult
(
1002001
,
null
);
async
verificationMtchOutTradeNo
(
obj
,
req
)
{
if
(
!
obj
||
!
obj
.
outTradeNo
||
!
obj
.
mchtId
||
!
obj
.
no
||
!
obj
.
openId
)
{
return
this
.
getCodeResult
(
1002001
,
null
);
}
let
no
=
await
this
.
getNo
(
obj
.
no
);
let
no
=
Number
(
await
this
.
getNo
(
obj
.
no
)
);
try
{
let
_cCashInfo
=
await
this
.
ccashinfoSve
.
getBean
({
id
:
no
,
outTradeNo
:
this
.
trim
(
obj
.
outTradeNo
),
mchtId
:
this
.
trim
(
obj
.
mchtId
),
})
||
{};
let
cashInfo
=
await
this
.
ccashinfoSve
.
findById
(
no
);
if
(
!
cashInfo
||
cashInfo
.
outTradeNo
!=
obj
.
outTradeNo
||
cashInfo
.
mchtId
!=
obj
.
mchtId
)
{
return
this
.
getErrResult
(
"提现信息错误"
);
}
let
cashUser
=
await
this
.
ccashuserSve
.
findOne
({
openId
:
obj
.
openId
});
cashUser
=
cashUser
||
{
id_name
:
cashInfo
.
id_name
,
id_no
:
cashInfo
.
id_no
};
let
epr
=
{};
if
(
_cCashInfo
.
ecid
)
{
epr
=
await
this
.
etemplateSve
.
allByEcid
(
_cC
ashInfo
.
ecid
)
||
{};
if
(
cashInfo
.
ecid
)
{
epr
=
await
this
.
etemplateSve
.
allByEcid
(
c
ashInfo
.
ecid
)
||
{};
}
let
resData
=
{
id_name
:
_cCashInfo
.
id_name
,
id_no
:
_cCashInfo
.
id_no
,
mainName
:
epr
.
main
.
name
,
companyName
:
epr
.
company
.
name
id_name
:
cashUser
.
id_name
,
id_no
:
cashUser
.
id_no
,
mainName
:
epr
.
main
.
name
,
companyName
:
epr
.
company
.
name
};
this
.
ccashinfoSve
.
formatStatus
(
resData
,
_cCashInfo
);
// 是否交易
if
(
cashInfo
.
trade_status
)
{
// 1 认证页面 2 二维码已失效 3 红包领取页面 4 红包领取结果页面(心跳查询) 5 红包已被领取
resData
.
redirect_code
=
2
;
return
this
.
getCodeResult
(
0
,
resData
);
}
// 是否认证
if
(
cashUser
.
contract_id
)
{
resData
.
redirect_code
=
3
;
return
this
.
getCodeResult
(
0
,
resData
);
}
// 滚去认证
resData
.
redirect_code
=
1
;
return
this
.
getCodeResult
(
0
,
resData
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
e
);
let
result
=
{
code
:
500
,
...
...
@@ -282,16 +300,14 @@ class BpoSDPJApi {
* fn:个人要素认证
* @returns {Promise<void>}
*/
async
authentication
(
obj
,
req
){
if
(
!
obj
||
!
obj
.
id_name
||
!
obj
.
id_no
||
!
obj
.
no
||
!
obj
.
openId
)
{
return
this
.
getCodeResult
(
1002001
,
null
);
async
authentication
(
obj
,
req
)
{
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
:
id
});
if
(
!
ccashinfo
){
try
{
let
cashInfo
=
await
this
.
ccashinfoSve
.
findById
(
id
);
if
(
!
cashInfo
)
{
return
this
.
getErrResult
(
"提现申请不存在"
);
}
if
(
!
await
this
.
idcardClient
.
checkIDCard
(
obj
.
id_no
))
{
...
...
@@ -299,13 +315,13 @@ class BpoSDPJApi {
}
let
num
=
await
this
.
esettleSve
.
isValidAge
([
obj
.
mchtId
]);
if
(
num
)
{
if
(
num
)
{
let
card
=
await
this
.
idcardClient
.
cardInfo
(
obj
.
id_no
);
let
age
=
card
.
age
||
0
;
if
(
!
age
)
{
if
(
!
age
)
{
return
this
.
getErrResult
(
"身份证号格式错误, 只支持18位身份证号码"
);
}
if
(
card
.
sex
==
'male'
)
{
if
(
card
.
sex
==
'male'
)
{
if
(
age
<
18
||
age
>
60
)
{
return
this
.
getErrResult
(
"签约失败,男限制18-60岁之间"
)
}
...
...
@@ -315,21 +331,32 @@ 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
});
let
cashUser
=
await
this
.
ccashuserSve
.
findOne
({
openId
:
obj
.
openId
});
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
);
ccashinfo
.
openId
=
this
.
trim
(
obj
.
openId
);
await
ccashinfo
.
save
();
if
(
!
cashUser
.
id
)
{
cashUser
.
cash_id
=
cashInfo
.
id
;
cashUser
.
id_name
=
this
.
trim
(
obj
.
id_name
);
cashUser
.
id_no
=
this
.
trim
(
obj
.
id_no
);
cashUser
.
openId
=
this
.
trim
(
obj
.
openId
);
cashUser
=
await
this
.
ccashuserSve
.
create
(
cashUser
);
}
// console.log("调用二要素 (兰伯望) 接口返回:"+JSON.stringify(doAuthRes));
await
this
.
doSign3
(
ccashinfo
);
return
{
code
:
0
,
msg
:
"认证成功"
,
data
:{
amt
:
system
.
f2y
(
ccashinfo
.
amt
),
mchtId
:
ccashinfo
.
mchtId
}};
}
catch
(
e
)
{
await
this
.
doSign3
(
cashInfo
,
cashUser
);
return
this
.
getCodeResult
(
0
,
{
redirect_code
:
3
});
}
catch
(
e
)
{
console
.
log
(
e
);
let
result
=
{
code
:
500
,
...
...
@@ -344,8 +371,8 @@ class BpoSDPJApi {
* fn:打开红包
* @param obj
*/
async
openRedEnvelopes
(
obj
){
if
(
!
obj
.
no
)
{
async
openRedEnvelopes
(
obj
)
{
if
(
!
obj
.
no
)
{
return
this
.
getBaseResult
(
1
,
'ID不能为空'
);
}
let
id
=
this
.
getNo
(
obj
.
no
);
...
...
@@ -353,19 +380,23 @@ class BpoSDPJApi {
id
:
id
})
||
{};
let
cashUser
=
await
this
.
ccashuserSve
.
findOne
({
openId
:
obj
.
openId
});
if
(
!
cashUser
)
{
return
this
.
getErrResult
(
"用户不存在"
);
}
let
key
=
`SDPJ_CASH_
${
ccashinfo
.
id
}
`
;
let
_lock
=
uuidv1
();
try
{
if
(
!
ccashinfo
)
{
return
this
.
getErrResult
(
"信息不存在"
);
}
if
(
ccashinfo
.
qrcode_status
!=
1
)
{
return
this
.
getErrResult
(
"二维码已作废,禁止提现"
);
// 1 认证页面 2 二维码已失效 3 红包领取页面 4 红包领取结果页面(心跳查询) 5 红包已被领取
return
this
.
getCodeResult
(
0
,
{
redirect_code
:
2
});
}
if
(
ccashinfo
.
trade_status
)
{
return
this
.
get
ErrResult
(
"已 提现,不要重复提现"
);
return
this
.
get
CodeResult
(
0
,
{
redirect_code
:
5
}
);
}
let
api
=
await
this
.
ecompanybusiSve
.
findOne
({
...
...
@@ -401,15 +432,15 @@ class BpoSDPJApi {
return
res
;
}
async
doSign3
(
cashInfo
)
{
async
doSign3
(
cashInfo
,
cashUser
)
{
let
result
;
// 专票签(三方签)
let
signParam
=
{
ecid
:
this
.
trim
(
cashInfo
.
ecid
),
appId
:
this
.
trim
(
cashInfo
.
app_id
),
userId
:
this
.
trim
(
cash
Info
.
id_no
),
idName
:
this
.
trim
(
cash
Info
.
id_name
),
idNo
:
this
.
trim
(
cash
Info
.
id_no
),
userId
:
this
.
trim
(
cash
User
.
id_no
),
idName
:
this
.
trim
(
cash
User
.
id_name
),
idNo
:
this
.
trim
(
cash
User
.
id_no
),
};
try
{
let
key
=
`
${
cashInfo
.
mcthId
}
_
${
cashInfo
.
outTradeNo
}
`
;
...
...
@@ -419,8 +450,8 @@ class BpoSDPJApi {
await
this
.
redisLock
.
unLock
(
key
,
id
);
if
(
result
.
data
&&
result
.
data
.
contractId
)
{
cash
Info
.
contract_id
=
result
.
data
.
contractId
;
cash
Info
.
save
();
cash
User
.
contract_id
=
result
.
data
.
contractId
;
cash
User
.
save
();
}
return
result
;
}
catch
(
e
)
{
...
...
@@ -431,13 +462,14 @@ class BpoSDPJApi {
async
cashOut
(
cashInfo
,
api
)
{
if
(
cashInfo
.
qrcode_status
!=
1
)
{
return
this
.
getErrResult
(
"二维码已作废,禁止提现"
);
// 1 认证页面 2 二维码已失效 3 红包领取页面 4 红包领取结果页面(心跳查询) 5 红包已被领取
return
this
.
getCodeResult
(
0
,
{
redirect_code
:
2
});
}
if
(
cashInfo
.
trade_status
)
{
return
this
.
get
ErrResult
(
"已提现,不要重复提现"
);
return
this
.
get
CodeResult
(
0
,
{
redirect_code
:
5
}
);
}
console
.
log
(
"张娇要看的时间发起提现---------------------------"
,
obj
.
outTradeNo
,
new
Date
().
getTime
());
console
.
log
(
"张娇要看的时间发起提现---------------------------"
,
cashInfo
.
outTradeNo
,
new
Date
().
getTime
());
// 发起交易
let
bizContent
=
[];
bizContent
.
push
({
...
...
@@ -485,7 +517,6 @@ class BpoSDPJApi {
url
:
settings
.
apiconfig
.
payDomain
()
+
"/merchant/order/transfer"
,
data
:
param
,
});
let
resData
=
{
amt
:
system
.
f2y
(
cashInfo
.
amt
)};
if
(
rs
.
data
.
code
===
0
)
{
cashInfo
.
trade_status
=
"01"
;
cashInfo
.
trade_desc
=
"提现申请成功"
;
...
...
@@ -497,16 +528,13 @@ class BpoSDPJApi {
console
.
log
(
eeee
);
}
await
cashInfo
.
save
();
this
.
ccashinfoSve
.
formatStatus
(
resData
,
cashInfo
);
return
this
.
getSuccessResult
(
"提现成功"
,
resData
);
// 1 认证页面 2 二维码已失效 3 红包领取页面 4 红包领取结果页面(心跳查询) 5 红包已被领取
return
this
.
getSuccessResult
(
"提现成功"
,
{
redirect_code
:
4
});
}
else
{
cashInfo
.
trade_status
=
"02"
;
cashInfo
.
trade_desc
=
rs
.
data
.
msg
||
"提现申请失败"
;
await
cashInfo
.
save
();
this
.
ccashinfoSve
.
formatStatus
(
resData
,
cashInfo
);
this
.
notifyCash
(
cashInfo
.
id
);
return
this
.
getSuccessResult
(
cashInfo
.
trade_desc
,
resData
);
return
this
.
getErrResult
(
rs
.
data
.
msg
||
"提现申请失败"
);
}
}
catch
(
error
)
{
console
.
log
(
error
);
...
...
@@ -514,6 +542,19 @@ class BpoSDPJApi {
}
}
async
checkCash
(
obj
,
req
)
{
let
id
=
Number
(
this
.
getNo
(
obj
.
no
)
||
0
);
let
cashInfo
=
await
this
.
ccashinfoSve
.
findById
(
id
);
if
(
cashInfo
.
trade_status
==
"00"
||
cashInfo
.
trade_status
==
"02"
)
{
// let actualAmt = await this.getActualAmt(cashInfo, api);
// cashInfo.actual_amt = actualAmt;
// await cashInfo.save();
return
this
.
getBaseResult
(
0
,
"交易完成"
,
{
complete
:
true
,
actual_amt
:
system
.
f2y
(
cashInfo
.
actual_amt
)});
}
return
this
.
getBaseResult
(
0
,
"交易未完成"
,
{
complete
:
false
});
}
async
testCashOutResult
(
obj
,
req
)
{
let
cashInfo
=
await
this
.
ccashinfoSve
.
findById
(
obj
.
id
);
let
api
=
await
this
.
ecompanybusiSve
.
findOne
({
...
...
@@ -578,7 +619,7 @@ class BpoSDPJApi {
async
wxnotify
(
obj
,
req
)
{
console
.
log
(
"张娇要看的时间发起提现后回调时间---------------------------"
,
obj
.
outTradeNo
,
new
Date
().
getTime
());
console
.
log
(
"------------- wx-sdpj转账回调 --------------"
,
obj
);
console
.
log
(
"------------- wx-sdpj转账回调 --------------"
,
obj
);
try
{
// 1. 获取转账二维码信息
let
cashInfo
=
await
this
.
ccashinfoSve
.
findOne
({
...
...
@@ -621,10 +662,10 @@ class BpoSDPJApi {
if
(
respTradeStatus
==
"00"
)
{
cashInfo
.
trade_status
=
"00"
;
cashInfo
.
trade_desc
=
"交易成功"
;
await
cashInfo
.
save
();
await
cashInfo
.
save
();
this
.
notifyCash
(
cashInfo
.
id
);
return
{
code
:
"0000"
};
}
else
if
(
respTradeStatus
==
"02"
||
respTradeStatus
==
"03"
)
{
}
else
if
(
respTradeStatus
==
"02"
||
respTradeStatus
==
"03"
)
{
cashInfo
.
trade_status
=
"02"
;
cashInfo
.
trade_desc
=
obj
.
respDesc
||
"交易失败"
;
await
cashInfo
.
save
();
...
...
@@ -639,18 +680,18 @@ class BpoSDPJApi {
// 通过postman推送回调
async
notifyGuestById
(
obj
,
req
)
{
let
res
=
await
this
.
notifyCash
(
obj
.
no
);
let
res
=
await
this
.
notifyCash
(
obj
.
no
);
return
this
.
getBaseResult
(
0
,
"调用成功"
,
res
);
}
// 推送回调
async
notifyCash
(
id
)
{
try
{
// 签名验证
if
(
!
id
)
{
if
(
!
id
)
{
return
this
.
getErrResult
(
"ID不能为空"
);
}
let
ccashinfo
=
await
this
.
ccashinfoSve
.
findOne
({
id
:
id
id
:
id
});
// if(!ccashinfo.app_id){
// return this.getErrResult("app_id不能为空");
...
...
@@ -670,7 +711,7 @@ class BpoSDPJApi {
// if(!ccashinfo.id_no){
// return this.getErrResult("id_no不能为空");
// }
if
(
!
ccashinfo
.
notify_url
)
{
if
(
!
ccashinfo
.
notify_url
)
{
return
this
.
getErrResult
(
"notify_url不能为空"
);
}
// 获取api信息
...
...
@@ -690,14 +731,14 @@ class BpoSDPJApi {
amt
:
ccashinfo
.
amt
,
idName
:
ccashinfo
.
id_name
,
idNo
:
ccashinfo
.
id_no
,
tradeStatus
:
ccashinfo
.
trade_status
,
nonceStr
:
await
this
.
getUidStr
(
32
,
36
),
tradeStatus
:
ccashinfo
.
trade_status
,
nonceStr
:
await
this
.
getUidStr
(
32
,
36
),
};
let
sign
=
system
.
getSign
(
param
,
api
.
key
,
this
.
EXCEPT_KEYS
)
param
.
sign
=
sign
;
let
sign
=
system
.
getSign
(
param
,
api
.
key
,
this
.
EXCEPT_KEYS
)
param
.
sign
=
sign
;
let
rs
=
await
axios
({
method
:
'post'
,
url
:
ccashinfo
.
notify_url
,
url
:
ccashinfo
.
notify_url
,
data
:
param
,
});
return
rs
.
data
;
...
...
@@ -716,11 +757,11 @@ class BpoSDPJApi {
return
this
.
getBaseResult
(
0
,
msg
,
data
);
}
getCodeResult
(
code
,
data
=
{})
{
getCodeResult
(
code
,
data
=
{})
{
return
this
.
getBaseResult
(
code
,
this
.
resultMap
[
code
],
data
);
}
getErrResult
(
msg
){
getErrResult
(
msg
)
{
return
this
.
getBaseResult
(
1
,
msg
);
}
...
...
@@ -733,4 +774,5 @@ class BpoSDPJApi {
return
res
;
}
}
module
.
exports
=
BpoSDPJApi
;
bpo-web/app/base/db/impl/ccashuserDao.js
0 → 100644
View file @
41f69487
const
system
=
require
(
"../../system"
);
const
Dao
=
require
(
"../dao.base"
);
class
CcashUserDao
extends
Dao
{
constructor
(){
super
(
Dao
.
getModelName
(
CcashUserDao
));
}
async
findByOpenId
(
openId
)
{
if
(
!
openId
)
{
return
[];
}
let
sql
=
`SELECT * FROM
${
this
.
model
.
tableName
}
WHERE openId = :openId`
;
return
await
this
.
customQuery
(
sql
,
{
openId
:
openId
});
}
}
module
.
exports
=
CcashUserDao
;
bpo-web/app/base/db/models/ccashuser.js
0 → 100644
View file @
41f69487
const
system
=
require
(
"../../system"
);
const
settings
=
require
(
"../../../config/settings"
);
const
uiconfig
=
system
.
getUiConfig2
(
settings
.
wxconfig
.
appId
);
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"ccashuser"
,
{
cash_id
:
DataTypes
.
INTEGER
,
openId
:
DataTypes
.
STRING
,
id_name
:
DataTypes
.
STRING
,
id_no
:
DataTypes
.
STRING
,
contract_id
:
DataTypes
.
STRING
,
},
{
paranoid
:
true
,
//假的删除
underscored
:
true
,
version
:
true
,
freezeTableName
:
true
,
//freezeTableName: true,
// define the table's name
tableName
:
'c_cash_user'
,
validate
:
{},
indexes
:
[
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
\ No newline at end of file
bpo-web/app/base/service/impl/ccashinfoSve.js
View file @
41f69487
...
...
@@ -3,6 +3,8 @@ const ServiceBase=require("../sve.base");
class
CcashinfoService
extends
ServiceBase
{
constructor
()
{
super
(
ServiceBase
.
getDaoName
(
CcashinfoService
));
this
.
ccashuserDao
=
system
.
getObject
(
"db.ccashuserDao"
);
}
...
...
bpo-web/app/base/service/impl/ccashuserSve.js
0 → 100644
View file @
41f69487
const
system
=
require
(
"../../system"
);
const
ServiceBase
=
require
(
"../sve.base"
);
class
CcashUserService
extends
ServiceBase
{
constructor
()
{
super
(
ServiceBase
.
getDaoName
(
CcashUserService
));
}
async
findByOpenId
(
openId
)
{
return
await
this
.
dao
.
findByOpenId
(
openId
);
}
}
module
.
exports
=
CcashUserService
;
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