|
|
@ -96,10 +96,30 @@ async function alarmList (ctx) { |
|
|
|
// 每个设备一个告警
|
|
|
|
for (let a of alarmRes) { |
|
|
|
if (positionD[a.cameraId]) { |
|
|
|
|
|
|
|
let curD = returnD[positionD[a.cameraId].positionReturnD] |
|
|
|
if (a.resolveId && !curD.resolve.some(r => r.id == a.resolveId)) { |
|
|
|
curD.resolve.push({ |
|
|
|
id: a.resolveId, |
|
|
|
resolve: a.resolve |
|
|
|
}) |
|
|
|
} |
|
|
|
if (a.strucId && !curD.struc.some(s => s.id == a.strucId)) { |
|
|
|
curD.struc.push({ |
|
|
|
id: a.strucId, |
|
|
|
name: a.strucName |
|
|
|
}) |
|
|
|
} |
|
|
|
} else { |
|
|
|
let d = { |
|
|
|
cameraId: a.cameraId, |
|
|
|
cameraName: a.cameraName, |
|
|
|
camerOnline: a.cameraOnline, |
|
|
|
cameraSerialNo: a.cameraSerialNo, |
|
|
|
cameraChannelNo: a.cameraChannelNo, |
|
|
|
createTime: a.createTime, |
|
|
|
updateTime: a.updateTime, |
|
|
|
platform: a.platform, |
|
|
|
statusDescribe: a.statusDescribe, |
|
|
|
alarmId: a.alarmId, |
|
|
|
resolve: [], |
|
|
|
struc: [] |
|
|
@ -110,12 +130,21 @@ async function alarmList (ctx) { |
|
|
|
resolve: a.resolve |
|
|
|
}) |
|
|
|
} |
|
|
|
if (a.strucId) { |
|
|
|
d.struc.push({ |
|
|
|
id: a.strucId, |
|
|
|
name: a.strucName |
|
|
|
}) |
|
|
|
} |
|
|
|
returnD.push(d) |
|
|
|
positionD[a.cameraId] = { |
|
|
|
positionReturnD: returnD.length - 1 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
ctx.status = 200; |
|
|
|
ctx.body = [] |
|
|
|
ctx.body = returnD |
|
|
|
} catch (error) { |
|
|
|
ctx.fs.logger.error(`path: ${ctx.path}, error: error`); |
|
|
|
ctx.status = 400; |
|
|
|