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
16427c15
Commit
16427c15
authored
May 19, 2022
by
宋毅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新接口
parent
73a692f2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
22 deletions
+32
-22
center-channel/app/config/routes/api.js
+32
-22
No files found.
center-channel/app/config/routes/api.js
View file @
16427c15
...
...
@@ -12,31 +12,20 @@ const settings = require("../../config/settings");
module
.
exports
=
function
(
app
)
{
//-----------------------新的模式---------web---------开始
//手动获取签名sign方法
app
.
use
(
'/op/sign/creatSign'
,
async
function
(
req
,
res
)
{
if
(
!
req
.
body
.
key
)
{
return
res
.
end
({
code
:
-
200
,
message
:
"缺少加签秘钥key参数"
});
}
if
(
!
req
.
body
.
obj
)
{
return
res
.
end
({
code
:
-
200
,
message
:
"缺少obj参数"
});
}
let
obj
=
req
.
body
.
obj
;
let
key
=
req
.
body
.
key
;
let
result
=
await
signSve
.
createSign
(
obj
,
key
);
return
res
.
end
(
JSON
.
stringify
(
result
));
});
app
.
use
(
'/tlpay/aliPayNotify'
,
async
function
(
req
,
res
)
{
//钉钉接入的搁浅
try
{
if
(
!
req
.
body
.
key
)
{
return
res
.
end
({
code
:
-
200
,
message
:
"缺少加签秘钥key参数"
});
}
if
(
!
req
.
body
.
obj
)
{
return
res
.
end
({
code
:
-
200
,
message
:
"缺少obj参数"
});
var
client_ip
=
system
.
get_client_ip
(
req
);
var
result
=
await
utilsOrderSve
.
opH5AliDingPayBackNotify
(
req
.
body
,
client_ip
);
logCtl
.
info
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"记录阿里钉钉支付回调处理结果"
,
op
:
"center-channel/tlpay/aliPayNotify"
,
content
:
"支付回调处理结果:"
+
JSON
.
stringify
(
result
),
clientIp
:
client_ip
||
""
});
if
(
result
.
status
!=
0
)
{
return
res
.
end
(
"FAIL"
);
}
let
obj
=
req
.
body
.
obj
;
let
key
=
req
.
body
.
key
;
let
result
=
await
signSve
.
createSign
(
obj
,
key
);
return
res
.
end
(
JSON
.
stringify
(
result
));
return
res
.
end
(
"success"
);
}
catch
(
error
)
{
logCtl
.
error
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"阿里钉钉支付回调处理异常"
,
...
...
@@ -404,6 +393,22 @@ module.exports = function (app) {
//-----------------------新的模式---------api---------开始
// //手动获取签名sign方法
// app.use("/op/sign/creatSign", async function (req, res) {
// if (!req.body.key) {
// res.end({code: -200, message: "缺少加签秘钥key参数"});
// return;
// }
// if (!req.body.obj) {
// res.end({code: -200, message: "缺少obj参数"});
// return;
// }
// let obj = req.body.obj;
// let key = req.body.key;
// let result = await signSve.createSign(obj, key);
// res.end(JSON.stringify(result));
// return;
// });
app
.
all
(
"/api/*"
,
async
function
(
req
,
res
,
next
)
{
let
result
=
system
.
getResult
(
null
,
"req method must is post"
);
if
(
req
.
method
!=
"POST"
)
{
...
...
@@ -453,6 +458,11 @@ module.exports = function (app) {
let
appInfo
=
appRes
.
data
;
//2.通过appsecret 验签
req
.
body
.
sign
=
sign
;
if
(
req
.
path
.
indexOf
(
"/sign/getSign"
)
>=
0
)
{
let
tmpSign
=
await
signSve
.
createSign
(
obj
,
appInfo
.
uapp_secret
);
res
.
end
(
JSON
.
stringify
(
tmpSign
));
return
;
}
//获取签名信息
let
verifyRes
=
await
signSve
.
verifySign
(
req
.
body
,
appInfo
.
uapp_secret
);
if
(
verifyRes
&&
verifyRes
.
status
==
0
)
{
req
.
body
.
appInfo
=
appInfo
;
...
...
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