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 })