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
7fbc278b
Commit
7fbc278b
authored
Mar 01, 2020
by
宋毅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tj
parent
ed7f5677
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
28 deletions
+15
-28
center-app/app/base/service/impl/utilsSve/utilstlbankSve.js
+15
-28
No files found.
center-app/app/base/service/impl/utilsSve/utilstlbankSve.js
View file @
7fbc278b
var
S
ystem
=
require
(
"../../../system"
);
var
s
ystem
=
require
(
"../../../system"
);
var
settings
=
require
(
"../../../../config/settings"
);
var
settings
=
require
(
"../../../../config/settings"
);
// const uiconfig = System.getUiConfig2(settings.wxconfig.appId);
// const logCtl = System.getObject("web.oplogCtl");
// const cacheManager = System.getObject("db.cacheManager");
const
querystring
=
require
(
'querystring'
);
const
querystring
=
require
(
'querystring'
);
// var moment = require("moment");
const
md5
=
require
(
"MD5"
);
const
md5
=
require
(
"MD5"
);
class
utilsTlBankSve
{
class
utilsTlBankSve
{
constructor
()
{
constructor
()
{
...
@@ -12,8 +8,8 @@ class utilsTlBankSve {
...
@@ -12,8 +8,8 @@ class utilsTlBankSve {
this
.
aliMethod
=
"A01"
;
//阿里订单支付
this
.
aliMethod
=
"A01"
;
//阿里订单支付
this
.
notifyUrl
=
"https://igirl.gongsibao.com/api/tl/zxNotify"
;
this
.
notifyUrl
=
"https://igirl.gongsibao.com/api/tl/zxNotify"
;
this
.
restClient
=
S
ystem
.
getObject
(
"util.restClient"
);
this
.
restClient
=
s
ystem
.
getObject
(
"util.restClient"
);
this
.
oplogDao
=
S
ystem
.
getObject
(
"db.common.oplogDao"
);
this
.
oplogDao
=
s
ystem
.
getObject
(
"db.common.oplogDao"
);
}
}
...
@@ -162,7 +158,7 @@ class utilsTlBankSve {
...
@@ -162,7 +158,7 @@ class utilsTlBankSve {
async
getReqBeforeParam
(
jsonObj
,
pay_key
)
{
//获取请求前的参数信息
async
getReqBeforeParam
(
jsonObj
,
pay_key
)
{
//获取请求前的参数信息
jsonObj
.
key
=
pay_key
;
jsonObj
.
key
=
pay_key
;
var
reqResult
=
{
status
:
0
,
msg
:
"
ok
"
,
req_param
:
null
};
var
reqResult
=
{
status
:
0
,
msg
:
"
success
"
,
req_param
:
null
};
var
signArr
=
[];
var
signArr
=
[];
var
keys
=
Object
.
keys
(
jsonObj
).
sort
();
var
keys
=
Object
.
keys
(
jsonObj
).
sort
();
if
(
keys
.
length
==
0
)
{
if
(
keys
.
length
==
0
)
{
...
@@ -190,7 +186,7 @@ class utilsTlBankSve {
...
@@ -190,7 +186,7 @@ class utilsTlBankSve {
}
}
async
resultSign
(
resultData
,
pay_key
)
{
//返回值进行验签
async
resultSign
(
resultData
,
pay_key
)
{
//返回值进行验签
var
rtnResult
=
{
status
:
0
,
msg
:
"
SUCCESS
"
};
var
rtnResult
=
{
status
:
0
,
msg
:
"
success
"
};
if
(
!
resultData
||
!
resultData
.
appid
)
{
if
(
!
resultData
||
!
resultData
.
appid
)
{
rtnResult
.
status
=
-
310
;
rtnResult
.
status
=
-
310
;
rtnResult
.
msg
=
"返回值信息data为空"
;
rtnResult
.
msg
=
"返回值信息data为空"
;
...
@@ -230,7 +226,7 @@ class utilsTlBankSve {
...
@@ -230,7 +226,7 @@ class utilsTlBankSve {
try
{
try
{
var
req_param
=
querystring
.
stringify
(
param
);
var
req_param
=
querystring
.
stringify
(
param
);
var
rtn
=
await
this
.
restClient
.
execPost2
(
req_param
,
reqUrl
);
var
rtn
=
await
this
.
restClient
.
execPost2
(
req_param
,
reqUrl
);
var
rtnResult
=
{
status
:
0
,
msg
:
"
SUCCESS
"
,
data
:
{}
};
var
rtnResult
=
{
status
:
0
,
msg
:
"
success
"
,
data
:
{}
};
if
(
rtn
&&
rtn
.
stdout
)
{
if
(
rtn
&&
rtn
.
stdout
)
{
var
tmpResult
=
JSON
.
parse
(
rtn
.
stdout
);
var
tmpResult
=
JSON
.
parse
(
rtn
.
stdout
);
if
(
tmpResult
.
retcode
==
"FAIL"
)
{
if
(
tmpResult
.
retcode
==
"FAIL"
)
{
...
@@ -315,11 +311,9 @@ class utilsTlBankSve {
...
@@ -315,11 +311,9 @@ class utilsTlBankSve {
async
receiveCallBackNotify
(
parmas
,
client_ip
)
{
//收到通联回调通知---post请求
async
receiveCallBackNotify
(
parmas
,
client_ip
)
{
//收到通联回调通知---post请求
var
result
=
{
status
:
-
1
,
msg
:
""
};
try
{
try
{
if
(
!
parmas
)
{
if
(
!
parmas
)
{
result
.
msg
=
"回调parmas中参数信息为空"
;
return
system
.
getResult
(
null
,
"回调parmas中参数信息为空"
);
return
result
;
}
}
var
isVerify
=
await
this
.
verifyCallBackParams
(
parmas
);
var
isVerify
=
await
this
.
verifyCallBackParams
(
parmas
);
if
(
isVerify
)
{
if
(
isVerify
)
{
...
@@ -334,27 +328,22 @@ class utilsTlBankSve {
...
@@ -334,27 +328,22 @@ class utilsTlBankSve {
attachList
.
push
(
parmas
.
cusorderid
);
attachList
.
push
(
parmas
.
cusorderid
);
}
}
if
(
attachList
.
length
<
2
)
{
if
(
attachList
.
length
<
2
)
{
result
.
msg
=
"回调cusorderid参数错误,没有_标识"
;
return
system
.
getResult
(
null
,
"回调cusorderid参数错误,没有_标识"
);
return
result
;
}
}
var
uappid
=
attachList
.
length
==
2
?
attachList
[
1
]
:
attachList
[
2
];
var
uappid
=
attachList
.
length
==
2
?
attachList
[
1
]
:
attachList
[
2
];
var
payParam
=
await
this
.
getpaymentinfo
(
uappid
);
var
payParam
=
await
this
.
getpaymentinfo
(
uappid
);
if
(
!
payParam
)
{
if
(
!
payParam
)
{
result
.
msg
=
"回调应用没有对应的支付凭证"
;
return
system
.
getResult
(
null
,
"回调应用没有对应的支付凭证"
);
return
result
;
}
}
var
appinfo
=
await
this
.
getappinfo
(
uappid
);
var
appinfo
=
await
this
.
getappinfo
(
uappid
);
if
(
!
appinfo
)
{
if
(
!
appinfo
)
{
result
.
msg
=
"回调应用没有对应的支付凭证"
;
return
system
.
getResult
(
null
,
"回调应用没有对应的支付凭证"
);
return
result
;
}
}
var
signResult
=
await
this
.
resultSign
(
parmas
,
payParam
.
pay_key
);
var
signResult
=
await
this
.
resultSign
(
parmas
,
payParam
.
pay_key
);
if
(
signResult
.
status
!=
0
)
{
if
(
signResult
.
status
!=
0
)
{
result
.
msg
=
signResult
.
msg
;
return
signResult
;
return
result
;
}
}
//解析支付参数
//解析支付参数
parmas
.
out_trade_no
=
attachList
[
0
].
substr
(
3
);
parmas
.
out_trade_no
=
attachList
[
0
].
substr
(
3
);
parmas
.
uappid
=
attachList
.
length
==
2
?
attachList
[
1
]
:
attachList
[
2
];
parmas
.
uappid
=
attachList
.
length
==
2
?
attachList
[
1
]
:
attachList
[
2
];
...
@@ -362,14 +351,12 @@ class utilsTlBankSve {
...
@@ -362,14 +351,12 @@ class utilsTlBankSve {
var
newparmas
=
await
this
.
getReqBeforeParam
(
parmas
,
appinfo
.
uapp_secret
);
var
newparmas
=
await
this
.
getReqBeforeParam
(
parmas
,
appinfo
.
uapp_secret
);
var
backResult
=
await
this
.
execReqInfo
(
null
,
payParam
.
notify_url
,
newparmas
.
req_param
);
var
backResult
=
await
this
.
execReqInfo
(
null
,
payParam
.
notify_url
,
newparmas
.
req_param
);
if
(
backResult
.
status
!=
0
)
{
if
(
backResult
.
status
!=
0
)
{
result
.
msg
=
backResult
.
msg
;
return
backResult
;
return
result
;
}
}
result
.
status
=
0
;
return
system
.
getResultSuccess
();
return
result
;
}
catch
(
e
)
{
}
catch
(
e
)
{
result
.
msg
=
"回调业务处理---error异常"
;
//TODO:异常日志记录
return
result
;
return
system
.
getResult
(
null
,
"回调业务处理---error异常"
)
;
}
}
}
}
...
...
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