From bc3553801254d63d915f875252584261c2fc4972 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Tue, 27 Sep 2022 21:02:19 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=86=E9=A2=91=E5=91=8A=E8=AD=A6=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=2050%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/alarm/video.js | 33 ++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/api/app/lib/controllers/alarm/video.js b/api/app/lib/controllers/alarm/video.js index 3d8521a..d626c32 100644 --- a/api/app/lib/controllers/alarm/video.js +++ b/api/app/lib/controllers/alarm/video.js @@ -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;