Commit c58d4b94 by 宋毅

tj

parent eb2d1214
...@@ -276,12 +276,11 @@ class tmqueryCtl extends CtlBase { ...@@ -276,12 +276,11 @@ class tmqueryCtl extends CtlBase {
}, },
isUser: "yes" isUser: "yes"
}; };
console.log("putPayOrderData###..." + JSON.stringify(param)); // console.log(param, "putPayOrderData########################################333333...........................");
// 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);
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................."); // console.log(tmp, "putPayOrderData########################################333333..........tmptmptmptmp.................");
} }
...@@ -310,8 +309,7 @@ class tmqueryCtl extends CtlBase { ...@@ -310,8 +309,7 @@ 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);
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) { if (tokenInfo.status != 0) {
return tokenInfo; return tokenInfo;
} }
...@@ -324,16 +322,14 @@ class tmqueryCtl extends CtlBase { ...@@ -324,16 +322,14 @@ 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);
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) { 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) {
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"); return system.getResultFail(-200, "操作error");
} }
} }
...@@ -352,8 +348,8 @@ class tmqueryCtl extends CtlBase { ...@@ -352,8 +348,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) {
...@@ -427,26 +423,25 @@ class tmqueryCtl extends CtlBase { ...@@ -427,26 +423,25 @@ 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));
console.log("req---->getJdPayPageAddr---->tmpContent:" + tmpContent); this.logClient.info("jd", "req---->getJdPayPageAddr---->options:" + JSON.stringify(options));
// this.logClient.info("jd", "req---->getJdPayPageAddr---->options:" + JSON.stringify(options)); this.logClient.info("jd", "req---->getJdPayPageAddr---->tmpContent:" + tmpContent);
// 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--getJdPayPageAddr-成功->>\nresult:", _data) console.log("\n--req---成功->>\nresult:", _data)
resolve({ result: true, data: _data }); resolve({ result: true, data: _data });
}); });
}); });
req.on('error', (e) => { req.on('error', (e) => {
console.error(`getJdPayPageAddr请求遇到问题-------------: ${e.message}`); console.error(`请求遇到问题-------------: ${e.message}`);
resolve({ result: false, errmsg: e.message }); resolve({ result: false, errmsg: e.message });
}); });
req.write(tmpContent); req.write(tmpContent);
...@@ -454,8 +449,7 @@ class tmqueryCtl extends CtlBase { ...@@ -454,8 +449,7 @@ class tmqueryCtl extends CtlBase {
}); });
return reqResult; return reqResult;
} catch (errorMsg) { } 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 }; return { success: false, code: -200, msg: error.stack };
} }
} }
...@@ -465,9 +459,6 @@ class tmqueryCtl extends CtlBase { ...@@ -465,9 +459,6 @@ 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, "签名错误");
} }
...@@ -512,7 +503,7 @@ class tmqueryCtl extends CtlBase { ...@@ -512,7 +503,7 @@ class tmqueryCtl extends CtlBase {
return resultUser; return resultUser;
} catch (error) { } catch (error) {
console.log(error.stack, "pushJdPayOrder----操作error..................."); console.log(error.stack, "操作error...................");
return system.getResultFail(-200, "操作error"); return system.getResultFail(-200, "操作error");
} }
} }
...@@ -585,6 +576,8 @@ class tmqueryCtl extends CtlBase { ...@@ -585,6 +576,8 @@ 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);
...@@ -608,6 +601,7 @@ class tmqueryCtl extends CtlBase { ...@@ -608,6 +601,7 @@ 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,13 +20,7 @@ module.exports = function (app) { ...@@ -20,13 +20,7 @@ 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),
...@@ -46,47 +40,29 @@ module.exports = function (app) { ...@@ -46,47 +40,29 @@ 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) {
console.log({ logClient.error("jd", {
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);
console.log({ logClient.payLog("jd", {
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;
...@@ -103,18 +79,12 @@ module.exports = function (app) { ...@@ -103,18 +79,12 @@ module.exports = function (app) {
return; return;
}); });
app.get("/jd/skipPage", async function (req, res) { app.get("/jd/skipPage", async function (req, res) {
console.log({ logClient.payLog("jd", {
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];
...@@ -125,18 +95,12 @@ module.exports = function (app) { ...@@ -125,18 +95,12 @@ 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) {
console.log({ logClient.payLog("jd", {
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