Commit 57bf62fc by sxy

fix: 日志列表

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