Commit e7a7dcb9 by 宋毅

tj

parent 9c22351f
......@@ -5,6 +5,14 @@ class CtlBase {
constructor() {
this.cacheManager = system.getObject("db.common.cacheManager");
this.redisClient = system.getObject("util.redisClient");
this.execClient = system.getObject("util.execClient");
this.logUrl = settings.channelApiUrl() + "/action/opLog";
}
error(param, token) {
var tmp = await this.execClient.execPostTK(param, this.logUrl + "/error", token);
}
info(param, token) {
var tmp = await this.execClient.execPostTK(param, this.logUrl + "/info", token);
}
getUUID() {
var uuid = uuidv4();
......
......@@ -11,9 +11,8 @@ class tmqueryCtl extends CtlBase {
1688: { appkey: "201911131657", secret: "eeb18393aade40149287b024d8ba0850" },
gsbhome: { appkey: "201912141625", secret: "8cbb846776874167b5c7e01cd0116c66" }
};
this.execClient = system.getObject("util.execClient");
this.logClient = system.getObject("util.logClient");
// this.logClient = system.getObject("util.logClient");
}
async doPost(pobj, obj, req) {
if (["subTmOrder", "getTmOrderList", "getTmOrderInfo", "getTmApplyInfo", "getTmNclList",
......@@ -507,6 +506,12 @@ class tmqueryCtl extends CtlBase {
//----------------------------gsb------操作------------start
async opGsbPayPageInfo(pobj, orderResult, req) {//操作下单的数据跟渠道订单关联
this.info({
optitle: "###操作下单的数据跟渠道订单关联参数",
op: "/gsbhome/opGsbPayPageInfo",
content: "pobj参数=" + JSON.stringify(pobj) + ",orderResult=" + JSON.stringify(orderResult),
clientIp: ""
});
if (!pobj.actionBody.itemCode) {
return system.getResult(null, "itemCode param is not empty");
}
......@@ -536,10 +541,20 @@ class tmqueryCtl extends CtlBase {
isUser: "yes"
};
var reqUrl = this.channelApiUrl + "/action/tmOrder/springBoard";
console.log("req---->opGsbPayPageInfo---->params:" + JSON.stringify(param) + ",reqUrl:" + reqUrl);
this.info({
optitle: "###操作下单的数据跟渠道订单关联参数---请求subGsbOrderInfo",
op: "/gsbhome/opGsbPayPageInfo",
content: "参数:" + JSON.stringify(param),
clientIp: ""
});
var payDataResult = await this.execClient.execPostTK(param, reqUrl, tokenInfo.data.token);
this.info({
optitle: "###操作下单的数据跟渠道订单关联参数---请求subGsbOrderInfo----结果",
op: "/gsbhome/opGsbPayPageInfo",
content: "结果:" + JSON.stringify(payDataResult),
clientIp: ""
});
if (!payDataResult && payDataResult.status != 1) {
console.log("req---->opGsbPayPageInfo---->error:" + JSON.stringify(payDataResult));
return system.getResult(null, "req error");
}
//更新订单信息
......@@ -549,11 +564,23 @@ class tmqueryCtl extends CtlBase {
return system.getResultSuccess({ payUrl: payDataResult.data.order_detail_url });
} catch (error) {
console.log("req---->opGsbPayPageInfo---->操作error:" + error.stack);
this.error({
optitle: "###操作下单的数据跟渠道订单关联参数---请求subGsbOrderInfo----异常",
op: "/gsbhome/opGsbPayPageInfo",
content: "结果:" + JSON.stringify(error.stack),
clientIp: ""
});
return system.getResultFail(-200, "操作error" + error.stack);
}
return system.getResultSuccess();
}
async pushGsbPayOrder(pushData, req) {//处理公司宝推送的订单信息
this.info({
optitle: "###处理公司宝推送的订单信息参数",
op: "/gsbhome/pushGsbPayOrder",
content: "pushData参数=" + JSON.stringify(pushData),
clientIp: ""
});
try {
var signResult = await this.createSign(pushData, "a7bbb13627cd11ea98c800163e06da98", true);
if (signResult.status != 0) {
......@@ -583,16 +610,27 @@ class tmqueryCtl extends CtlBase {
};
var reqUrl = this.channelApiUrl + "/action/tmOrder/springBoard";
var resultUser = await this.execClient.execPostTK(param, reqUrl, tokenInfo.data.token);
this.info({
optitle: "###处理公司宝推送的订单结果",
op: "/gsbhome/pushGsbPayOrder",
content: "result=" + JSON.stringify(resultUser),
clientIp: ""
});
if (!resultUser) {
return system.getResult(null, "req error");
}
return resultUser;
} catch (error) {
console.log(error.stack, "操作error...................");
this.error({
optitle: "###处理公司宝推送的订单异常",
op: "/gsbhome/pushGsbPayOrder",
content: "error=" + JSON.stringify(error.stack),
clientIp: ""
});
return system.getResultFail(-200, "操作error");
}
}
//----------------------------gsb------操作------------end
}
......
......@@ -19,7 +19,6 @@ class CacheBase {
}
async cache(inputkey, val, ex, ...items) {
const cachekey = this.prefix + inputkey;
console.log(cachekey,"cachekey.............basecache");
var cacheValue = await this.redisClient.get(cachekey);
if (!cacheValue || cacheValue == "undefined" || cacheValue == "null" || this.isdebug) {
var objvalstr = await this.buildCacheVal(cachekey, inputkey, val, ex, ...items);
......
......@@ -205,20 +205,8 @@ module.exports = function (app) {
res.redirect(skipUrl);
});
app.get("/gsbhome/orderNotify", async function (req, res) {
// logClient.payLog("jd", {
// optitle: "###操作订单结果参数...orderNotify",
// op: "/jd/orderNotify",
// content: "req.query=" + JSON.stringify(req.query) + ",req.body=" + JSON.stringify(req.body),
// clientIp: ""
// });
req.query.actionProcess = "gsbhome";
var result = await tmqueryCtl.pushGsbPayOrder(req.query, req);
// logClient.payLog("jd", {
// optitle: "###操作订单结果...orderNotify",
// op: "/jd/orderNotify",
// content: "result=" + JSON.stringify(result),
// clientIp: ""
// });
if (result.status != 0) {
res.end(JSON.stringify(result));
return;
......
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