Commit eb2d1214 by 宋毅

tj

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