Commit 1f4380d6 by 宋毅

tj

parent 5f5d7db5
...@@ -17,9 +17,9 @@ class ErrorLogDao extends Dao { ...@@ -17,9 +17,9 @@ class ErrorLogDao extends Dao {
var params = { var params = {
identify_code: actionBody.identifyCode, identify_code: actionBody.identifyCode,
op_title: opTitle, op_title: opTitle,
push_content: actionBody, push_content: actionBody || null,
error_info: error, error_info: error || null,
result_info: execResult, result_info: execResult || null,
request_id: actionBody.requestId, request_id: actionBody.requestId,
client_ip: actionBody.clientIp || "", client_ip: actionBody.clientIp || "",
created_at: new Date() created_at: new Date()
......
const system = require("../system"); const system = require("../system");
const util = require('util'); const util = require('util');
const axios = require('axios'); // const axios = require('axios');
class EsUtils { class EsUtils {
constructor() { constructor() {
this.execClient = system.getObject("util.execClient"); this.execClient = system.getObject("util.execClient");
...@@ -49,32 +49,32 @@ class EsUtils { ...@@ -49,32 +49,32 @@ class EsUtils {
async execPostEs(queuedName, params, reqUrl, esName, esPwd) { async execPostEs(queuedName, params, reqUrl, esName, esPwd) {
try { try {
let result = await axios({ // let result = await axios({
// headers: {'Content-Type': 'application/x-www-form-urlencoded'}, // // headers: {'Content-Type': 'application/x-www-form-urlencoded'},
headers: { // headers: {
'Content-type': 'application/json', // 'Content-type': 'application/json',
'Authorization': 'Basic YWRtaW5lczphZG1pbkdTQmVzLg==' // 'Authorization': 'Basic YWRtaW5lczphZG1pbkdTQmVzLg=='
}, // },
method: 'POST', // method: 'POST',
url: reqUrl, // url: reqUrl,
data: JSON.stringify(params), // data: JSON.stringify(params),
timeout: 5000 // timeout: 5000
}); // });
if (result.status == 201) { // if (result.status == 201) {
return system.getResultSuccess(); // return system.getResultSuccess();
} // }
this.errorLogDao.addOpErrorLogs(queuedName + "执行execPostEs存在错误", params, result, null, 3); // this.errorLogDao.addOpErrorLogs(queuedName + "执行execPostEs存在错误", params, result, null, 3);
return system.getResult(null, "执行execPostEs存在错误"); // return system.getResult(null, "执行execPostEs存在错误");
//方式二 //方式二
// var rtn = await this.execClient.execPostEs(params, reqUrl, esName, esPwd); var result = await this.execClient.execPostEs(params, reqUrl, esName, esPwd);
// if (!rtn || !rtn.stdout) { if (!result || !result.stdout) {
// return system.getResult(null, "execPostTimeOut data is empty"); this.errorLogDao.addOpErrorLogs(queuedName + "执行execPostEs存在错误", params, result, null, 3);
// } return system.getResult(null, "执行execPostEs存在错误");
// var result = JSON.parse(rtn.stdout); return system.getResult(null, "execPostTimeOut data is empty");
// return result; }
return system.getResultSuccess();
} catch (error) { } catch (error) {
console.log(error.stack, "......axios........."); console.log(error.stack, "......axios.........");
this.errorLogDao.addOpErrorLogs(queuedName + "执行execPostEs存在异常", params, null, error.stack, 3); this.errorLogDao.addOpErrorLogs(queuedName + "执行execPostEs存在异常", params, null, error.stack, 3);
......
var settings = { var settings = {
redis: { redis: {
host: "121.36.3.35", // host: "121.36.3.35",
port: 6379, // port: 6379,
// host: "43.247.184.32", host: "43.247.184.32",
// port: 8967, port: 8967,
password: "Gongsibao2018", password: "Gongsibao2018",
db: 5, db: 5,
}, },
......
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