You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
2.1 KiB
78 lines
2.1 KiB
'use strict';
|
|
async function deviceType (ctx) {
|
|
try {
|
|
const { models } = ctx.fs.dc;
|
|
|
|
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
|
|
}
|
|
}
|
|
}
|
|
|
|
async function alarmList (ctx) {
|
|
try {
|
|
const { models } = ctx.fs.dc;
|
|
const { clickHouse } = ctx.app.fs
|
|
const { keyword } = cyx.query
|
|
|
|
const alarmRes = await clickHouse.vcmp.query(`
|
|
SELECT
|
|
camera.id AS cameraId,
|
|
camera.name AS cameraName,
|
|
camera_status_alarm.id AS alarmId,
|
|
camera_status_alarm.create_time AS createTime,
|
|
camera_status_alarm.update_time AS updateTime,
|
|
camera_status_alarm.platform AS platform,
|
|
camera_status_resolve.resolve AS resolve
|
|
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()
|
|
|
|
let returnD = []
|
|
// 每个设备一个告警
|
|
// for (let a of alarmRes) {
|
|
// if ()
|
|
// }
|
|
|
|
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
|
|
}
|
|
}
|
|
}
|
|
|
|
async function confirm (ctx) {
|
|
try {
|
|
const { models } = ctx.fs.dc;
|
|
|
|
ctx.status = 20;
|
|
} catch (error) {
|
|
ctx.fs.logger.error(`path: ${ctx.path}, error: error`);
|
|
ctx.status = 400;
|
|
ctx.body = {
|
|
message: typeof error == 'string' ? error : undefined
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
deviceType,
|
|
alarmList
|
|
};
|