Commit fda4caf3 by 宋毅

tj

parent de68e3de
...@@ -7,7 +7,8 @@ class tmqueryCtl extends CtlBase { ...@@ -7,7 +7,8 @@ class tmqueryCtl extends CtlBase {
super(); super();
this.channelApiUrl = settings.channelApiUrl(); this.channelApiUrl = settings.channelApiUrl();
this.appInfo = { this.appInfo = {
jd: { appkey: "201911251551", secret: "56006077354d48858026c80c0e10bef6" } jd: { appkey: "201911251551", secret: "56006077354d48858026c80c0e10bef6" },
1688: { appkey: "201911131657", secret: "eeb18393aade40149287b024d8ba0850" }
}; };
this.execClient = system.getObject("util.execClient"); this.execClient = system.getObject("util.execClient");
...@@ -127,6 +128,9 @@ class tmqueryCtl extends CtlBase { ...@@ -127,6 +128,9 @@ class tmqueryCtl extends CtlBase {
case "jd": case "jd":
reqParam = self.appInfo["jd"]; reqParam = self.appInfo["jd"];
break; break;
case "1688":
reqParam = self.appInfo["jd"];
break;
default: default:
break; break;
} }
...@@ -208,7 +212,7 @@ class tmqueryCtl extends CtlBase { ...@@ -208,7 +212,7 @@ class tmqueryCtl extends CtlBase {
req.session.userPinInfo.encryptChannelUserId = resultUser.data || ""; req.session.userPinInfo.encryptChannelUserId = resultUser.data || "";
return system.getResultSuccess({ encryptChannelUserId: resultUser.data || "" }); return system.getResultSuccess({ encryptChannelUserId: resultUser.data || "" });
} catch (error) { } catch (error) {
console.log(error.stack, "操作error..................."); console.log(error.stack, "操作error...................getUserIdEncryptStr");
return system.getResultFail(-200, "操作error"); return system.getResultFail(-200, "操作error");
} }
} }
...@@ -233,12 +237,13 @@ class tmqueryCtl extends CtlBase { ...@@ -233,12 +237,13 @@ class tmqueryCtl extends CtlBase {
req.session.userPinInfo = resultUser.data; req.session.userPinInfo = resultUser.data;
return resultUser; return resultUser;
} catch (error) { } catch (error) {
console.log(error.stack, "操作error..................."); console.log(error.stack, "操作error...................getUserInfoTest");
return system.getResultFail(-200, "操作error"); return system.getResultFail(-200, "操作error");
} }
} }
async getUserInfo(pobj, qobj, req) { async getJdUserInfo(pobj, qobj, req) {
try { try {
this.logClient.error("jd", "getUserInfo--error--->pobj:" + JSON.stringify(pobj));
if (req.session.userPinInfo) { if (req.session.userPinInfo) {
return system.getResultSuccess({ encryptChannelUserId: req.session.userPinInfo.encryptChannelUserId || "" }); return system.getResultSuccess({ encryptChannelUserId: req.session.userPinInfo.encryptChannelUserId || "" });
} }
......
...@@ -4,16 +4,24 @@ class LogClient { ...@@ -4,16 +4,24 @@ class LogClient {
constructor() { constructor() {
log4js.configure(settings.basepath + "/app/config/log4js.json"); log4js.configure(settings.basepath + "/app/config/log4js.json");
this.logerInfo = log4js.getLogger("info_file"); this.logerInfo = log4js.getLogger("info_file");
// this.logerError = log4js.getLogger("error_file"); this.logerError = log4js.getLogger("error_file");
this.logerPay = log4js.getLogger("pay_file");
// this.logerHttp=log4js.getLogger("http"); // this.logerHttp=log4js.getLogger("http");
} }
async info(channelCode, msg) { async info(channelCode, msg) {
var tmpMsg = typeof (msg) == "string" ? msg : JSON.stringify(msg);
this.logerInfo.info("_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________"); this.logerInfo.info("_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________");
this.logerInfo.info("渠道:" + channelCode + "...info..." + msg); this.logerInfo.info("渠道:" + channelCode + "..." + tmpMsg);
} }
async error(channelCode, msg) { async error(channelCode, msg) {
this.logerInfo.info("_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________"); var tmpMsg = typeof (msg) == "string" ? msg : JSON.stringify(msg);
this.logerInfo.error("渠道:" + channelCode + "...error..." + msg); this.logerError.error("_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________");
this.logerError.error("渠道:" + channelCode + "..." + tmpMsg);
}
async payLog(channelCode, msg) {
var tmpMsg = typeof (msg) == "string" ? msg : JSON.stringify(msg);
this.logerPay.info("_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________");
this.logerPay.info("接收渠道付款信息:" + channelCode + "..." + tmpMsg);
} }
} }
module.exports = LogClient; module.exports = LogClient;
...@@ -23,6 +23,15 @@ ...@@ -23,6 +23,15 @@
"backups": 5, "backups": 5,
"pattern": "-yyyy-MM-dd-hh.log", "pattern": "-yyyy-MM-dd-hh.log",
"category": "error_file" "category": "error_file"
},
"pay_file": {
"type": "file",
"filename": "logs/payFile/pay",
"encoding": "utf-8",
"maxLogSize": 10000000000,
"backups": 5,
"pattern": "-yyyy-MM-dd-hh.log",
"category": "pay_file"
} }
}, },
"categories": { "categories": {
...@@ -32,6 +41,18 @@ ...@@ -32,6 +41,18 @@
], ],
"level": "DEBUG" "level": "DEBUG"
}, },
"error_file": {
"appenders": [
"error_file"
],
"level": "DEBUG"
},
"pay_file": {
"appenders": [
"pay_file"
],
"level": "DEBUG"
},
"http": { "http": {
"appenders": [ "appenders": [
"access" "access"
......
...@@ -16,7 +16,13 @@ module.exports = function (app) { ...@@ -16,7 +16,13 @@ module.exports = function (app) {
authUrl: "https://oauth2.jdcloud.com/userinfo", authUrl: "https://oauth2.jdcloud.com/userinfo",
authToken: params.token_type + " " + params.access_token authToken: params.token_type + " " + params.access_token
}; };
var userItemResult = await tmqueryCtl.getUserInfo(getUserparams, req.query, req); var userItemResult = await tmqueryCtl.getJdUserInfo(getUserparams, req.query, req);
logClient.payLog("jd", {
optitle: "###获取京东用户结果...getJdUserInfo",
op: "/jdtm/getUser",
content: "参数=" + JSON.stringify(getUserparams) + ",result=" + JSON.stringify(userItemResult),
clientIp: ""
});
if (userItemResult.status != 0) { if (userItemResult.status != 0) {
res.redirect("/#/jd/jdtrademark"); res.redirect("/#/jd/jdtrademark");
return; return;
...@@ -31,8 +37,42 @@ module.exports = function (app) { ...@@ -31,8 +37,42 @@ 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", "req---->/jdtm/getUser---->error:" + error.stack); 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: ""
});
req.query.actionProcess = "jd";
var result = await tmqueryCtl.pushPayOrder(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;
} }
var params =
{
instanceId: req.query.orderBizId,
appInfo: {
authUrl: "http://oauth2.jdcloud.com/authorize?response_type=token&redirect_uri=http://tm.plus.jdcloud.com/jdtm/getUser&state=jdindentlist&client_id=9841572588670903"
}
};
res.end(JSON.stringify(params));
return;
}); });
app.get("/jdtm/getUserTest", async function (req, res) { app.get("/jdtm/getUserTest", async function (req, res) {
console.log(req.query, "/jdtm/getUser...................."); console.log(req.query, "/jdtm/getUser....................");
...@@ -55,35 +95,6 @@ module.exports = function (app) { ...@@ -55,35 +95,6 @@ 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);
}); });
app.get("/jd/orderNotify", async function (req, res) {
// oplogCtl.info({
// 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.pushPayOrder(req.query, req);
// oplogCtl.info({
// optitle: "############################################操作订单结果.................orderNotify",
// op: "/jd/orderNotify",
// content: "req.query=" + JSON.stringify(req.query) + ",req.body=" + JSON.stringify(req.body),
// clientIp: ""
// });
if (result.status != 0) {
res.end(JSON.stringify(result));
return;
}
var params =
{
instanceId: req.query.orderBizId,
appInfo: {
authUrl: "http://oauth2.jdcloud.com/authorize?response_type=token&redirect_uri=http://tm.plus.jdcloud.com/jdtm/getUser&state=jdindentlist&client_id=9841572588670903"
}
};
res.end(JSON.stringify(params));
return;
});
app.get("/", async function (req, res) { app.get("/", async function (req, res) {
try { try {
var appinfo = await metaCtl.getAppInfo(req); var appinfo = await metaCtl.getAppInfo(req);
......
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