Commit 896f8ecd by 宋毅

tj

parent bc6ea7ff
......@@ -182,61 +182,5 @@ class APIBase {
return rtnerror;
}
}
//-----------------------新的模式------------------开始
async doexecMethod(gname, methodname, pobj, query, req) {
req.requestId = this.getUUID();
try {
// //验证accesskey或验签
// var isPassResult = await this.checkAcck(gname, methodname, pobj, query, req);
// if (isPassResult.status != 0) {
// isPassResult.requestId = "";
// return isPassResult;
// }
var rtn = await this[methodname](pobj, query, req);
this.logCtl.createDb({
appid: req.app.id,
appkey: req.app.uappKey,
requestId: req.requestId,
op: req.classname + "/" + methodname,
content: JSON.stringify(pobj),
resultInfo: JSON.stringify(rtn),
clientIp: req.clientIp,
agent: req.uagent,
opTitle: "api服务提供方appKey:" + settings.appKey,
});
rtn.requestId = req.requestId;
return rtn;
} catch (e) {
console.log(e.stack, "api调用出现异常,请联系管理员..........")
this.logCtl.createDb({
appid: req.app.id,
appkey: req.app.uappKey,
requestId: req.requestId,
op: req.classname + "/" + methodname,
content: JSON.stringify(pobj),
resultInfo: JSON.stringify(e.stack),
clientIp: req.clientIp,
agent: req.uagent,
opTitle: "api调用出现异常,请联系管理员error,appKey:" + settings.appKey,
});
this.logCtl.error({
appid: req.app.id,
appkey: req.app.uappKey,
requestId: req.requestId,
op: pobj.classname + "/" + methodname,
content: e.stack,
clientIp: pobj.clientIp,
agent: req.uagent,
optitle: "api调用出现异常,请联系管理员",
});
var rtnerror = system.getResultFail(-200, "出现异常,error:" + e.stack);
rtnerror.requestId = req.requestId;
return rtnerror;
}
}
//-----------------------新的模式------------------结束
}
module.exports = APIBase;
......@@ -99,18 +99,7 @@ class APIBase extends DocBase {
});
return rtn;
} catch (e) {
console.log(e.stack, "api调用出现异常,请联系管理员..........")
this.logCtl.error({
appid: req.headers["app_id"] || "",
appkey: req.headers["accesskey"] || "",
requestId: requestid,
op: pobj.classname + "/" + methodname,
content: e.stack,
clientIp: pobj.clientIp,
agent: req.uagent,
optitle: "api调用出现异常,请联系管理员",
});
var rtnerror = system.getResultFail(-200, "出现异常,请联系管理员");
var rtnerror = system.getResultFail(-200, "异常");
rtnerror.requestid = requestid;
return rtnerror;
}
......
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