Commit 5404d891 by 宋毅

tj

parent 282f2183
...@@ -4,6 +4,7 @@ const uuidv4 = require('uuid/v4'); ...@@ -4,6 +4,7 @@ const uuidv4 = require('uuid/v4');
const md5 = require("MD5"); const md5 = require("MD5");
class WEBBase { class WEBBase {
constructor() { constructor() {
this.execClientNew = system.getObject("util.execClientNew");
this.restClient = system.getObject("util.restClient"); this.restClient = system.getObject("util.restClient");
this.execClientNew = system.getObject("util.execClientNew"); this.execClientNew = system.getObject("util.execClientNew");
this.cacheManager = system.getObject("db.common.cacheManager"); this.cacheManager = system.getObject("db.common.cacheManager");
...@@ -21,20 +22,24 @@ class WEBBase { ...@@ -21,20 +22,24 @@ class WEBBase {
async doexecMethod(gname, methodname, pobj, query, req) { async doexecMethod(gname, methodname, pobj, query, req) {
req.requestId = this.getUUID(); req.requestId = this.getUUID();
try { try {
var rtn = await this[methodname](pobj, query, req); var result = await this[methodname](pobj, query, req);
if (!result.requestId) {
result.requestId = pobj.RequestId ? pobj.RequestId : pobj.requestId || req.requestId;
}
this.logCtl.createDb({ this.logCtl.createDb({
appid: req.app.id, appid: req.app.id,
appkey: req.app.uappKey, appkey: req.app.uappKey,
requestId: req.requestId, requestId: req.requestId,
op: req.classname + "/" + methodname, op: req.classname + "/" + methodname,
content: JSON.stringify(pobj), content: JSON.stringify(pobj),
resultInfo: JSON.stringify(rtn), resultInfo: JSON.stringify(result),
clientIp: req.clientIp, clientIp: req.clientIp,
agent: req.uagent, agent: req.uagent,
opTitle: "api服务提供方appKey:" + settings.appKey, opTitle: "api服务提供方appKey:" + settings.appKey,
}); });
rtn.requestId = req.requestId; var tmpResult = pobj.actionType && pobj.actionType.indexOf("List") < 0 ? result : { status: result.status, message: result.message, requestId: result.requestId };
return rtn; this.execClientNew.execLogs("reqPath:" + req.path, pobj, "center-channel-doexecMethod-web", tmpResult, null);
return result;
} catch (e) { } catch (e) {
console.log(e.stack, "api调用出现异常,请联系管理员..........") console.log(e.stack, "api调用出现异常,请联系管理员..........")
this.logCtl.createDb({ this.logCtl.createDb({
......
...@@ -92,6 +92,7 @@ class ExecClientNew { ...@@ -92,6 +92,7 @@ class ExecClientNew {
this.execLogs(execFile + "执行execPostTimeOutByBusiness,errorInfo信息为请求的返回结果", params, params.identifyCode, reqResult, rtn); this.execLogs(execFile + "执行execPostTimeOutByBusiness,errorInfo信息为请求的返回结果", params, params.identifyCode, reqResult, rtn);
return reqResult; return reqResult;
} catch (error) { } catch (error) {
console.log("执行execPostByTimeOut存在异常", error.stack);
reqResult = system.getResultFail(-200, execFile + "执行execPostByTimeOut存在异常"); reqResult = system.getResultFail(-200, execFile + "执行execPostByTimeOut存在异常");
reqResult.requestId = requestId || uuid.v1(); reqResult.requestId = requestId || uuid.v1();
this.execLogs(execFile + "执行execPostByTimeOut存在异常", params, params.identifyCode, reqResult, error.stack); this.execLogs(execFile + "执行execPostByTimeOut存在异常", params, params.identifyCode, reqResult, error.stack);
......
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