From 8914cca35aebd683b998cf33ebf60988558ce56a Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Mon, 26 Sep 2022 16:02:11 +0800 Subject: [PATCH] https --- api/app/lib/controllers/alarm/data.js | 9 +++++--- api/app/lib/controllers/alarm/video.js | 30 ++++++++++++++++++++++++++ web/client/index.ejs | 2 +- 3 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 api/app/lib/controllers/alarm/video.js diff --git a/api/app/lib/controllers/alarm/data.js b/api/app/lib/controllers/alarm/data.js index 68cd57e..00c969e 100644 --- a/api/app/lib/controllers/alarm/data.js +++ b/api/app/lib/controllers/alarm/data.js @@ -128,16 +128,19 @@ async function list (ctx) { `).toPromise() : []; - const alarmDetailCount = await clickHouse.dataAlarm.query(` + const detailCountAlarm = alarmRes + .map(ar => "'" + ar.AlarmId + "'") + const alarmDetailCount = detailCountAlarm.length ? await clickHouse.dataAlarm.query(` SELECT count(Time) AS count, AlarmId FROM alarm_details WHERE - AlarmId IN (${confirmedAlarm.join(',')}) + AlarmId IN (${detailCountAlarm.join(',')}) AND AlarmState < 3 GROUP BY AlarmId - `).toPromise() + `).toPromise() : + [] alarmRes.forEach(ar => { diff --git a/api/app/lib/controllers/alarm/video.js b/api/app/lib/controllers/alarm/video.js new file mode 100644 index 0000000..8bff5e7 --- /dev/null +++ b/api/app/lib/controllers/alarm/video.js @@ -0,0 +1,30 @@ +'use strict'; + +async function alarmList (ctx) { + try { + const { models } = ctx.fs.dc; + const { clickHouse } = ctx.app.fs + + // const alarmRes= await clickHouse.vcmp.query(` + // SELECT + // * + // FROM + // camera_status_alarm + // LEFT JOIN + + // `).toPromise() + + ctx.status = 200; + ctx.body = [] + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: error`); + ctx.status = 400; + ctx.body = { + message: typeof error == 'string' ? error : undefined + } + } +} + +module.exports = { + +}; \ No newline at end of file diff --git a/web/client/index.ejs b/web/client/index.ejs index a2612bd..9cbe876 100644 --- a/web/client/index.ejs +++ b/web/client/index.ejs @@ -5,7 +5,7 @@ - +