Browse Source

视频告警列表获取

dev
巴林闲侠 2 years ago
parent
commit
e66f800928
  1. 28
      api/app/lib/controllers/alarm/video.js
  2. 5
      api/app/lib/routes/alarm/index.js

28
api/app/lib/controllers/alarm/video.js

@ -5,14 +5,24 @@ async function alarmList (ctx) {
const { models } = ctx.fs.dc; const { models } = ctx.fs.dc;
const { clickHouse } = ctx.app.fs const { clickHouse } = ctx.app.fs
// const alarmRes= await clickHouse.vcmp.query(` const alarmRes = await clickHouse.vcmp.query(`
// SELECT SELECT
// * camera.name AS cameraName,
// FROM camera_status_alarm.create_time AS createTime,
// camera_status_alarm camera_status_alarm.update_time AS updateTime,
// LEFT JOIN camera_status_alarm.platform AS platform,
camera_status_resolve.resolve AS resolve
// `).toPromise() FROM
camera_status_alarm
LEFT JOIN camera
ON camera.serial_no = camera_status_alarm.serial_no
AND camera.channel_no = camera_status_alarm.channel_no
LEFT JOIN camera_status
ON camera_status_alarm.platform = camera_status.platform
AND camera_status_alarm.status_id = camera_status.id
LEFT JOIN camera_status_resolve
ON camera_status_resolve.status_id = camera_status.id
`).toPromise()
ctx.status = 200; ctx.status = 200;
ctx.body = [] ctx.body = []
@ -26,5 +36,5 @@ async function alarmList (ctx) {
} }
module.exports = { module.exports = {
alarmList
}; };

5
api/app/lib/routes/alarm/index.js

@ -4,6 +4,7 @@
const application = require('../../controllers/alarm/app'); const application = require('../../controllers/alarm/app');
const dataAlarm = require('../../controllers/alarm/data'); const dataAlarm = require('../../controllers/alarm/data');
const videoAlarm = require('../../controllers/alarm/video')
module.exports = function (app, router, opts) { module.exports = function (app, router, opts) {
// 应用告警 // 应用告警
@ -43,4 +44,8 @@ module.exports = function (app, router, opts) {
app.fs.api.logAttr['PUT/alarm/data/confirm'] = { content: '确认数据告警', visible: true }; app.fs.api.logAttr['PUT/alarm/data/confirm'] = { content: '确认数据告警', visible: true };
router.put('/alarm/data/confirm', dataAlarm.confirm(opts)); router.put('/alarm/data/confirm', dataAlarm.confirm(opts));
// 视频告警
app.fs.api.logAttr['GET/alarm/video/list'] = { content: '查询视频告警列表', visible: true };
router.get('/alarm/video/list', videoAlarm.alarmList);
}; };

Loading…
Cancel
Save