Commit 16427c15 by 宋毅

新接口

parent 73a692f2
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment