Commit c58d4b94 by 宋毅

tj

parent eb2d1214
......@@ -276,12 +276,11 @@ class tmqueryCtl extends CtlBase {
},
isUser: "yes"
};
console.log("putPayOrderData###..." + JSON.stringify(param));
// this.logClient.info(pobj.actionProcess, "putPayOrderData###..." + JSON.stringify(param));
// console.log(param, "putPayOrderData########################################333333...........................");
this.logClient.info(pobj.actionProcess, "putPayOrderData###..." + JSON.stringify(param));
var reqUrl = this.channelApiUrl + "/action/tmOrder/springBoard";
var tmp = await this.execClient.execPostTK(param, reqUrl, tokenInfo.data.token);
console.log("putPayOrderData###...Result-->" + JSON.stringify(tmp));
// this.logClient.info(pobj.actionProcess, "putPayOrderData###...Result-->" + JSON.stringify(tmp));
this.logClient.info(pobj.actionProcess, "putPayOrderData###...Result-->" + JSON.stringify(tmp));
// console.log(tmp, "putPayOrderData########################################333333..........tmptmptmptmp.................");
}
......@@ -310,8 +309,7 @@ class tmqueryCtl extends CtlBase {
return system.getResult(null, "处理用户请求失败,msg:" + result.error_description);
}
var tokenInfo = await this.getToken(actionProcess);
console.log("getUserInfo----->tokenInfo:" + JSON.stringify(tokenInfo));
// this.logClient.info("jd", "getUserInfo----->tokenInfo:" + JSON.stringify(tokenInfo));
this.logClient.info("jd", "getUserInfo----->tokenInfo:" + JSON.stringify(tokenInfo));
if (tokenInfo.status != 0) {
return tokenInfo;
}
......@@ -324,16 +322,14 @@ class tmqueryCtl extends CtlBase {
};
var reqUrl = this.channelApiUrl + "/action/tmTools/springBoard";
var resultUser = await this.execClient.execPostTK(param, reqUrl, tokenInfo.data.token);
console.log("getUserInfo----->resultUser:" + JSON.stringify(resultUser));
// this.logClient.info("jd", "getUserInfo----->resultUser:" + JSON.stringify(resultUser));
this.logClient.info("jd", "getUserInfo----->resultUser:" + JSON.stringify(resultUser));
if (!resultUser) {
return system.getResult(null, "处理请求失败");
}
req.session.userPinInfo = resultUser.data;
return system.getResultSuccess({ encryptChannelUserId: resultUser.data.encryptChannelUserId || "" });
} catch (error) {
console.log("req---->getUserInfo---->error:" + error.stack);
// this.logClient.error("jd", "req---->getUserInfo---->error:" + error.stack);
this.logClient.error("jd", "req---->getUserInfo---->error:" + error.stack);
return system.getResultFail(-200, "操作error");
}
}
......@@ -352,8 +348,8 @@ class tmqueryCtl extends CtlBase {
// '{"success":true,"code":null,"msg":null,"data":{"orderNumber":"6058867","erpOrderId":"523198741458590844",
// "returnUrl":"https://buy.jdcloud.com/pay?orderId=523198741458590844","saasCheckUrl":null}}' }
// this.logClient.info("jd", "opJdPayPageInfo--tmpResult-->" + JSON.stringify(tmpResult));
console.log("opJdPayPageInfo--tmpResult-->" + JSON.stringify(tmpResult));
this.logClient.info("jd", "opJdPayPageInfo--tmpResult-->" + JSON.stringify(tmpResult));
if (tmpResult && tmpResult.result && tmpResult.result == true) {
var payDataResult = JSON.parse(tmpResult.data);
if (payDataResult && payDataResult.success && payDataResult.success == true) {
......@@ -427,26 +423,25 @@ class tmqueryCtl extends CtlBase {
for (let [key, value] of ctx.headers) {
options.headers[key] = value
}
console.log("req---->getJdPayPageAddr---->options:" + JSON.stringify(options));
console.log("req---->getJdPayPageAddr---->tmpContent:" + tmpContent);
// this.logClient.info("jd", "req---->getJdPayPageAddr---->options:" + JSON.stringify(options));
// this.logClient.info("jd", "req---->getJdPayPageAddr---->tmpContent:" + tmpContent);
this.logClient.info("jd", "req---->getJdPayPageAddr---->options:" + JSON.stringify(options));
this.logClient.info("jd", "req---->getJdPayPageAddr---->tmpContent:" + tmpContent);
var reqResult = await new Promise(function (resolve, reject) {
let req = http.request(options, function (res) {
// res.setEncoding(encoding);
// console.log("statusCode: ", res.statusCode);
// console.log("headers: ", res.headers);
console.log("statusCode: ", res.statusCode);
console.log("headers: ", res.headers);
var _data = '';
res.on('data', function (chunk) {
_data += chunk;
});
res.on('end', function () {
console.log("\n--req--getJdPayPageAddr-成功->>\nresult:", _data)
console.log("\n--req---成功->>\nresult:", _data)
resolve({ result: true, data: _data });
});
});
req.on('error', (e) => {
console.error(`getJdPayPageAddr请求遇到问题-------------: ${e.message}`);
console.error(`请求遇到问题-------------: ${e.message}`);
resolve({ result: false, errmsg: e.message });
});
req.write(tmpContent);
......@@ -454,8 +449,7 @@ class tmqueryCtl extends CtlBase {
});
return reqResult;
} catch (errorMsg) {
console.log("req---->getJdPayPageAddr---->error:" + error.stack);
// this.logClient.error("jd", "req---->getJdPayPageAddr---->error:" + error.stack);
this.logClient.error("jd", "req---->getJdPayPageAddr---->error:" + error.stack);
return { success: false, code: -200, msg: error.stack };
}
}
......@@ -465,9 +459,6 @@ class tmqueryCtl extends CtlBase {
if (signResult.status != 0) {
return signResult;
}
if (!pushData.token) {
return system.getResult(null, "token is empty");
}
if (signResult.data != pushData.token.toUpperCase()) {
return system.getResult(null, "签名错误");
}
......@@ -512,7 +503,7 @@ class tmqueryCtl extends CtlBase {
return resultUser;
} catch (error) {
console.log(error.stack, "pushJdPayOrder----操作error...................");
console.log(error.stack, "操作error...................");
return system.getResultFail(-200, "操作error");
}
}
......@@ -585,6 +576,8 @@ class tmqueryCtl extends CtlBase {
options.headers[key] = value
}
this.logClient.info("jd", "req---->getJdPayPageAddr---->options:" + JSON.stringify(options));
this.logClient.info("jd", "req---->getJdPayPageAddr---->tmpContent:" + tmpContent);
var reqResult = await new Promise(function (resolve, reject) {
let req = http.request(options, function (res) {
// res.setEncoding(encoding);
......@@ -608,6 +601,7 @@ class tmqueryCtl extends CtlBase {
});
return reqResult;
} catch (errorMsg) {
this.logClient.error("jd", "req---->getJdPayPageAddr---->error:" + error.stack);
return { success: false, code: -200, msg: error.stack };
}
}
......
......@@ -20,13 +20,7 @@ module.exports = function (app) {
authToken: params.token_type + " " + params.access_token
};
var userItemResult = await tmqueryCtl.getJdUserInfo(getUserparams, req.query, req);
// logClient.info("jd", {
// optitle: "###获取京东用户结果...getJdUserInfo",
// op: "/jdtm/getUser",
// content: "参数=" + JSON.stringify(getUserparams) + ",result=" + JSON.stringify(userItemResult),
// clientIp: ""
// });
console.log({
logClient.info("jd", {
optitle: "###获取京东用户结果...getJdUserInfo",
op: "/jdtm/getUser",
content: "参数=" + JSON.stringify(getUserparams) + ",result=" + JSON.stringify(userItemResult),
......@@ -46,47 +40,29 @@ module.exports = function (app) {
var skipUrl = "/#/jd/" + params.state + "?channelUserId=" + encodeURIComponent(userItemResult.data.encryptChannelUserId);
res.redirect(skipUrl);
} catch (error) {
console.log({
logClient.error("jd", {
optitle: "###获取京东用户异常...getJdUserInfo",
op: "/jdtm/getUser",
content: error.stack,
clientIp: ""
});
// logClient.error("jd", {
// optitle: "###获取京东用户异常...getJdUserInfo",
// op: "/jdtm/getUser",
// content: error.stack,
// clientIp: ""
// });
}
});
app.get("/jd/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: ""
// });
console.log({
optitle: "###操作订单结果参数...orderNotify.............................................................",
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 = "jd";
var result = await tmqueryCtl.pushJdPayOrder(req.query, req);
console.log({
optitle: "###操作订单结果...orderNotify.............................................................",
logClient.payLog("jd", {
optitle: "###操作订单结果...orderNotify",
op: "/jd/orderNotify",
content: "result=" + JSON.stringify(result),
clientIp: ""
});
// logClient.payLog("jd", {
// optitle: "###操作订单结果...orderNotify",
// op: "/jd/orderNotify",
// content: "result=" + JSON.stringify(result),
// clientIp: ""
// });
if (result.status != 0) {
res.end(JSON.stringify(result));
return;
......@@ -103,18 +79,12 @@ module.exports = function (app) {
return;
});
app.get("/jd/skipPage", async function (req, res) {
console.log({
logClient.payLog("jd", {
optitle: "###操作订单结果后跳转参数...skipPage",
op: "/jd/skipPage",
content: "req.query=" + JSON.stringify(req.query) + ",req.body=" + JSON.stringify(req.body),
clientIp: ""
});
// logClient.payLog("jd", {
// optitle: "###操作订单结果后跳转参数...skipPage",
// op: "/jd/skipPage",
// content: "req.query=" + JSON.stringify(req.query) + ",req.body=" + JSON.stringify(req.body),
// clientIp: ""
// });
var channelUserId = req.query.channelUserId;
if (channelUserId && channelUserId.indexOf('?') >= 0) {
channelUserId = channelUserId.split("?")[0];
......@@ -125,18 +95,12 @@ module.exports = function (app) {
};
var userItemResult = await tmqueryCtl.getUserIdEncryptStr(getUserparams, req.query, req);
if (userItemResult.status != 0) {
console.log({
logClient.payLog("jd", {
optitle: "###操作订单结果...orderNotify...加密用户错误",
op: "/jd/orderNotify",
content: "result=" + JSON.stringify(result),
clientIp: ""
});
// logClient.payLog("jd", {
// optitle: "###操作订单结果...orderNotify...加密用户错误",
// op: "/jd/orderNotify",
// content: "result=" + JSON.stringify(result),
// clientIp: ""
// });
res.redirect("/#/jd/jdtrademark");
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