|
@ -14,10 +14,18 @@ module.exports = function (app, opts) { |
|
|
'video': '视频异常', |
|
|
'video': '视频异常', |
|
|
'app': '应用异常' |
|
|
'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) { |
|
|
async function sendAppearToWeb(datas, ttype) { |
|
|
try { |
|
|
try { |
|
|
//告警类型
|
|
|
let alarmTypee = null, jumpUrl = null//告警类型 跳转地址
|
|
|
let alarmTypee = null |
|
|
|
|
|
|
|
|
|
|
|
//项目信息
|
|
|
//项目信息
|
|
|
let { projects, pepProjects } = await getProjectsInfo(datas); |
|
|
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(); |
|
|
`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 |
|
|
alarmTypee = alarm_group.length ? constAlarmGroups[alarm_group[0].alarm_group] : null |
|
|
|
|
|
jumpUrl = alarm_group.length ? constAlarmUrls[alarm_group[0].alarm_group] : null |
|
|
} else { |
|
|
} else { |
|
|
alarmTypee = constAlarmGroups[ttype] |
|
|
alarmTypee = constAlarmGroups[ttype] |
|
|
|
|
|
jumpUrl = constAlarmUrls[ttype] |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
let sendData = [] |
|
|
let sendData = [] |
|
@ -41,7 +51,8 @@ module.exports = function (app, opts) { |
|
|
source: ld.alarmInfo.sourceName, |
|
|
source: ld.alarmInfo.sourceName, |
|
|
alarmGroup: ld.alarmInfo.type,//异常类型
|
|
|
alarmGroup: ld.alarmInfo.type,//异常类型
|
|
|
time: ld.time, |
|
|
time: ld.time, |
|
|
type: alarmTypee//告警类型
|
|
|
type: alarmTypee,//告警类型
|
|
|
|
|
|
jumpUrl//跳转地址
|
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
//app.socket.emit('alarmSendSocket', { type: 'alarmAppear', sendData })
|
|
|
//app.socket.emit('alarmSendSocket', { type: 'alarmAppear', sendData })
|
|
|