From 5c15d8798cc31281a5a0fd67d1bed654bbe83f73 Mon Sep 17 00:00:00 2001 From: wuqun Date: Fri, 4 Nov 2022 11:23:18 +0800 Subject: [PATCH] =?UTF-8?q?(*)=E5=91=8A=E8=AD=A6=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E5=8A=A0=E4=B8=8A=E8=B7=B3=E8=BD=AC=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/utils/alarmHandle.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/api/app/lib/utils/alarmHandle.js b/api/app/lib/utils/alarmHandle.js index 55be102..f146d2b 100644 --- a/api/app/lib/utils/alarmHandle.js +++ b/api/app/lib/utils/alarmHandle.js @@ -14,10 +14,18 @@ module.exports = function (app, opts) { 'video': '视频异常', 'app': '应用异常' } + let constAlarmUrls = { + 1: '/problem/dataAlarm/dataLnterrupt', + 2: '/problem/dataAlarm/dataAbnormal', + 3: '/problem/dataAlarm/strategyHit', + 4: '/problem/deviceAlarm/deviceAbnormal', + 5: '/problem/deviceAlarm/deviceAbnormal', + 'video': '/problem/dataAlarm/videoAbnormal', + 'app': '/problem/useAlarm/useAbnormal' + } async function sendAppearToWeb(datas, ttype) { try { - //告警类型 - let alarmTypee = null + let alarmTypee = null, jumpUrl = null//告警类型 跳转地址 //项目信息 let { projects, pepProjects } = await getProjectsInfo(datas); @@ -28,8 +36,10 @@ module.exports = function (app, opts) { `SELECT alarm_group FROM t_alarm_code WHERE code='${datas[0].alarmInfo.alarmCode}'`).toPromise(); alarmTypee = alarm_group.length ? constAlarmGroups[alarm_group[0].alarm_group] : null + jumpUrl = alarm_group.length ? constAlarmUrls[alarm_group[0].alarm_group] : null } else { alarmTypee = constAlarmGroups[ttype] + jumpUrl = constAlarmUrls[ttype] } let sendData = [] @@ -41,7 +51,8 @@ module.exports = function (app, opts) { source: ld.alarmInfo.sourceName, alarmGroup: ld.alarmInfo.type,//异常类型 time: ld.time, - type: alarmTypee//告警类型 + type: alarmTypee,//告警类型 + jumpUrl//跳转地址 }) }) //app.socket.emit('alarmSendSocket', { type: 'alarmAppear', sendData })