Commit 6def9669 by 宋毅

tj

parent 841290d7
......@@ -9,8 +9,27 @@ var cacheBaseComp = null;
class UserCtl extends CtlBase {
constructor() {
super("auth", CtlBase.getServiceName(UserCtl));
this.execClient = system.getObject("util.execClient");
}
async getUserInfo(pobj, qobj, req) {
try {
var result = await this.execClient.execPostJDTK("", this.jdOauthUrl, qobj.access_token);
console.log(result, "getUserInfo.....result.......");
if (!result || !result.account) {
return system.getResult(null, "处理用户请求失败,msg:" + result.error_description);
}
return system.getResultSuccess(result);
} catch (error) {
console.log(e.stack, "操作error...................");
return system.getResult(null, "操作失败");
}
}
/**
* 开放平台回调处理
* @param {*} req
......
......@@ -158,19 +158,7 @@ class tmqueryCtl extends CtlBase {
return system.getResultSuccess(resultTmpSign);
}
async getUserInfo(pobj, qobj, req) {
try {
var result = await this.execClient.execPostJDTK("", this.jdOauthUrl, qobj.access_token);
console.log(result, "getUserInfo.....result.......");
if (!result || !result.account) {
return system.getResult(null, "处理用户请求失败,msg:" + result.error_description);
}
return system.getResultSuccess(result);
} catch (error) {
console.log(e.stack, "操作error...................");
return system.getResult(null, "操作失败");
}
}
}
module.exports = tmqueryCtl;
......
......@@ -42,6 +42,29 @@ module.exports = function (app) {
}
});
app.get('/jdtm/:gname/:qname/:method', function (req, res) {
try {
var classPath = req.params["qname"];
var methodName = req.params["method"];
var gname = req.params["gname"];
classPath = gname + "." + classPath;
var params = [];
params.push(methodName);
params.push(req.body);
params.push(req.query);
params.push(req);
var p = null;
var invokeObj = System.getObject("web." + classPath);
if (invokeObj["doexec"]) {
p = invokeObj["doexec"].apply(invokeObj, params);
}
p.then(r => {
res.end(JSON.stringify(r));
});
} catch (error) {
console.log(error.stack, "get/web/:gname/:qname/:method,error.............");
}
});
app.get('/web/:gname/:qname/:method', function (req, res) {
try {
var classPath = req.params["qname"];
......
......@@ -34,6 +34,7 @@
"gulp-if": "^3.0.0",
"gulp-minify-css": "^1.2.4",
"gulp-sass": "^4.0.2",
"jdcloud-sdk-signer": "^2.0.1",
"method-override": "^2.3.10",
"morgan": "^1.9.0",
"multer": "^1.3.0",
......
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