Commit 57bf62fc by sxy

fix: 日志列表

parent 38509f8b
...@@ -74,9 +74,8 @@ class System { ...@@ -74,9 +74,8 @@ class System {
}, },
body: data body: data
}, function (error, response, body) { }, function (error, response, body) {
console.log(response)
console.log(error)
if (!error) { if (!error) {
console.log(body);
rtn.statusCode = response.statusCode rtn.statusCode = response.statusCode
if (body) { if (body) {
rtn.data = body rtn.data = body
...@@ -85,6 +84,7 @@ class System { ...@@ -85,6 +84,7 @@ class System {
} }
resv(rtn); resv(rtn);
} else { } else {
console.log(error)
rej(error) rej(error)
} }
}); });
...@@ -257,45 +257,45 @@ class System { ...@@ -257,45 +257,45 @@ class System {
} }
} }
/** /**
* 记录日志信息 * 记录日志信息
* @param {*} opTitle 操作的标题 * @param {*} opTitle 操作的标题
* @param {*} params 参数 * @param {*} params 参数
* @param {*} identifyCode 业务标识 * @param {*} identifyCode 业务标识
* @param {*} resultInfo 返回结果 * @param {*} resultInfo 返回结果
* @param {*} errorInfo 错误信息 * @param {*} errorInfo 错误信息
*/ */
static execLogs(opTitle, params, identifyCode, resultInfo, errorInfo) { static execLogs(opTitle, params, identifyCode, resultInfo, errorInfo) {
var reqUrl = settings.logUrl(); var reqUrl = settings.logUrl();
let isLogData=true let isLogData = true
if(params.method && (params.method.indexOf("find")>=0 || params.method.indexOf("get")>=0)){ if (params.method && (params.method.indexOf("find") >= 0 || params.method.indexOf("get") >= 0)) {
isLogData=false isLogData = false
} }
var param = { var param = {
actionType: "produceLogsData",// Y 功能名称 actionType: "produceLogsData",// Y 功能名称
actionBody: { actionBody: {
opTitle: opTitle || "",// N 操作的业务标题 opTitle: opTitle || "",// N 操作的业务标题
identifyCode: identifyCode || "brg-center-manage",// Y 操作的业务标识 identifyCode: identifyCode || "brg-center-manage",// Y 操作的业务标识
indexName: settings.logindex,// Y es索引值,同一个项目用一个值 indexName: settings.logindex,// Y es索引值,同一个项目用一个值
messageBody: params, //日志的描述信息 messageBody: params, //日志的描述信息
resultInfo:isLogData? resultInfo:{status:resultInfo.status},//返回信息 resultInfo: isLogData ? resultInfo : { status: resultInfo.status },//返回信息
errorInfo: errorInfo,//错误信息 errorInfo: errorInfo,//错误信息
requestId: resultInfo.requestId || "" requestId: resultInfo.requestId || ""
} }
}; };
console.log(JSON.stringify(param)) console.log(JSON.stringify(param))
let P=new Promise((resv,rej)=>{ let P = new Promise((resv, rej) => {
this.postJsonTypeReq(reqUrl,param).then(res=>{ this.postJsonTypeReq(reqUrl, param).then(res => {
if(res.statusCode==200){ if (res.statusCode == 200) {
resv(res.data) resv(res.data)
}else{ } else {
rej(null) rej(null)
} }
}); });
}) })
return P return P
} }
} }
Date.prototype.Format = function (fmt) { //author: meizz Date.prototype.Format = function (fmt) { //author: meizz
......
...@@ -16,27 +16,29 @@ class LogClient { ...@@ -16,27 +16,29 @@ class LogClient {
async log(pobj, req, rtninfo, errinfo) { async log(pobj, req, rtninfo, errinfo) {
rtninfo.requestId = this.getUUID() rtninfo.requestId = this.getUUID()
req.params.param = pobj req.params.param = pobj
//第三个字段应该存公司id if (!["findSystemMsgCount", "findUnreadCount"].includes(req.params && req.params.method || '')) {
system.execLogs(settings.appname + "_" + req.xctx.codetitle, req.params, pobj.company_id + "_", rtninfo, errinfo).then(res => { //第三个字段应该存公司id
if (res && res.status == 1) { system.execLogs(settings.appname + "_" + req.xctx.codetitle, req.params, "_" + pobj.company_id + "_", rtninfo, errinfo).then(res => {
console.log("log.....success") if (res && res.status == 1) {
} else { console.log("log.....success")
} else {
console.log("log.....fail")
}
}).catch(e => {
console.log("log.....fail") console.log("log.....fail")
} })
}).catch(e => { }
console.log("log.....fail")
})
} }
async logList(pobj) { async logList(pobj) {
let { search, pageInfo, company_id } = pobj; let { search, pageInfo, company_id } = pobj;
let query = { let query = {
indexName: settings.logindex, indexName: `logs-sytxpublic-msgq-${settings.logindex}`,
pageSize: pageInfo.pageSize, pageSize: pageInfo.pageSize,
currentPage: pageInfo.pageNo currentPage: pageInfo.pageNo
}; };
if (company_id && company_id != 1) { if (company_id && company_id != 1) {
query.identifyCode = company_id query.identifyCode = `_${company_id}_`
} }
if (search.opTitle) { if (search.opTitle) {
query.opTitle = search.opTitle query.opTitle = search.opTitle
......
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