|
@ -23,7 +23,7 @@ module.exports = function (app, opts) { |
|
|
'video': '/problem/dataAlarm/videoAbnormal', |
|
|
'video': '/problem/dataAlarm/videoAbnormal', |
|
|
'app': '/problem/useAlarm/useAbnormal' |
|
|
'app': '/problem/useAlarm/useAbnormal' |
|
|
} |
|
|
} |
|
|
async function sendAppearToWeb(datas, ttype) { |
|
|
async function sendAppearToWeb (datas, ttype) { |
|
|
try { |
|
|
try { |
|
|
let alarmTypee = null, jumpUrl = null//告警类型 跳转地址
|
|
|
let alarmTypee = null, jumpUrl = null//告警类型 跳转地址
|
|
|
|
|
|
|
|
@ -62,7 +62,7 @@ module.exports = function (app, opts) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function sendConfirmToWeb(logDatas, isAuto) { |
|
|
async function sendConfirmToWeb (logDatas, isAuto) { |
|
|
try { |
|
|
try { |
|
|
//用户信息
|
|
|
//用户信息
|
|
|
let userName = null |
|
|
let userName = null |
|
@ -94,7 +94,7 @@ module.exports = function (app, opts) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function getProjectsInfo(datas) { |
|
|
async function getProjectsInfo (datas) { |
|
|
try { |
|
|
try { |
|
|
let pIds = datas.map(l => l.projectCorrelationId);//所有的项目的id
|
|
|
let pIds = datas.map(l => l.projectCorrelationId);//所有的项目的id
|
|
|
let projects = await models.ProjectCorrelation.findAll({ |
|
|
let projects = await models.ProjectCorrelation.findAll({ |
|
@ -104,8 +104,10 @@ module.exports = function (app, opts) { |
|
|
|
|
|
|
|
|
let pepPojectIds = new Set(); |
|
|
let pepPojectIds = new Set(); |
|
|
for (let p of projects) { |
|
|
for (let p of projects) { |
|
|
|
|
|
if (p.pepProjectId) { |
|
|
pepPojectIds.add(p.pepProjectId); |
|
|
pepPojectIds.add(p.pepProjectId); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
let pepProjects = pepPojectIds.size ? await clickHouse.projectManage.query(` |
|
|
let pepProjects = pepPojectIds.size ? await clickHouse.projectManage.query(` |
|
|
SELECT id, project_name FROM t_pim_project WHERE id IN (${[...pepPojectIds]}, -1)` |
|
|
SELECT id, project_name FROM t_pim_project WHERE id IN (${[...pepPojectIds]}, -1)` |
|
@ -117,7 +119,7 @@ module.exports = function (app, opts) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function sendNoticeToWeb(pepUsers, data) { |
|
|
async function sendNoticeToWeb (pepUsers, data) { |
|
|
try { |
|
|
try { |
|
|
let { cfgName, tactics, tacticsParams, projectCorrelationId, time } = data; |
|
|
let { cfgName, tactics, tacticsParams, projectCorrelationId, time } = data; |
|
|
//项目信息
|
|
|
//项目信息
|
|
@ -140,7 +142,7 @@ module.exports = function (app, opts) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function socketThrottle(type, dataList) { |
|
|
async function socketThrottle (type, dataList) { |
|
|
try { |
|
|
try { |
|
|
if (!msgSendObj.time || moment() > moment(msgSendObj.time).add(1, 'minute')) {//首次 || 跟上次时间间隔大于1分钟 直接发送
|
|
|
if (!msgSendObj.time || moment() > moment(msgSendObj.time).add(1, 'minute')) {//首次 || 跟上次时间间隔大于1分钟 直接发送
|
|
|
msgSendObj.dataMap[type] = dataList; |
|
|
msgSendObj.dataMap[type] = dataList; |
|
|