Commit bba46df7 by 宋毅

tj

parent e28db10e
......@@ -188,7 +188,16 @@ class tmqueryCtl extends CtlBase {
async getUserIdEncryptStr(pobj, qobj, req) {
try {
if (!req.session.userPinInfo) {
return system.getResult(null, "user is not login...");
var userInfo = await this.createUserInfo(pobj, qobj, req);
if (userInfo.status != 0) {
return system.getResult(null, "user is not login...");
}
if (req.session.userPinInfo.encryptChannelUserId) {
return system.getResultSuccess({ encryptChannelUserId: req.session.userPinInfo.encryptChannelUserId });
}
}
if (req.session.userPinInfo.encryptChannelUserId) {
return system.getResultSuccess({ encryptChannelUserId: req.session.userPinInfo.encryptChannelUserId });
}
var tokenInfo = await this.getToken(pobj.actionProcess);
if (tokenInfo.status != 0) {
......@@ -216,7 +225,7 @@ class tmqueryCtl extends CtlBase {
return system.getResultFail(-200, "操作error");
}
}
async getUserInfoTest(pobj, qobj, req) {
async createUserInfo(pobj, qobj, req) {
try {
var tokenInfo = await this.getToken(pobj.actionProcess);
if (tokenInfo.status != 0) {
......@@ -226,7 +235,7 @@ class tmqueryCtl extends CtlBase {
var param = {
actionProcess: pobj.actionProcess,
actionType: "createChannelUser",
actionBody: { channelUserId: pobj.tmpchannelUserId },
actionBody: { channelUserId: pobj.channelUserId },
isUser: "yes"
};
var reqUrl = this.channelApiUrl + "/action/tmTools/springBoard";
......
......@@ -64,11 +64,27 @@ module.exports = function (app) {
res.end(JSON.stringify(result));
return;
}
var getUserparams = {
actionProcess: "jd",
channelUserId: req.query.jdPin
};
var userItemResult = await tmqueryCtl.getUserIdEncryptStr(getUserparams, req.query, req);
if (userItemResult.status != 0) {
logClient.payLog("jd", {
optitle: "###操作订单结果...orderNotify...加密用户错误",
op: "/jd/orderNotify",
content: "result=" + JSON.stringify(result),
clientIp: ""
});
res.redirect("/#/jd/jdtrademark");
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"
// authUrl: "http://oauth2.jdcloud.com/authorize?response_type=token&redirect_uri=http://tm.plus.jdcloud.com/jdtm/getUser&state=jdindentlist&client_id=9841572588670903"
authUrl: "http://tm.plus.jdcloud.com/#/jd/jdindentlist?channelUserId=" + encodeURIComponent(userItemResult.data.encryptChannelUserId)
}
};
res.end(JSON.stringify(params));
......@@ -85,9 +101,9 @@ module.exports = function (app) {
actionProcess: "jd",
authUrl: "https://oauth2.jdcloud.com/userinfo",
authToken: params.token_type + " " + params.access_token,
tmpchannelUserId: params.tmpchannelUserId
channelUserId: params.tmpchannelUserId
};
var userItemResult = await tmqueryCtl.getUserInfoTest(getUserparams, req.query, req);
var userItemResult = await tmqueryCtl.createUserInfo(getUserparams, req.query, req);
if (userItemResult.status != 0) {
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