diff --git a/api/.vscode/launch.json b/api/.vscode/launch.json index aaedb1e..043f6c7 100644 --- a/api/.vscode/launch.json +++ b/api/.vscode/launch.json @@ -54,7 +54,7 @@ "--clickHouseAnxincloud Anxinyun11", "--clickHousePepEmis pepca8", "--clickHouseProjectManage peppm8", - "--clickHouseVcmp video_accrss1", + "--clickHouseVcmp video_access_dev", "--clickHouseDataAlarm default", "--confirmAlarmAnxinUserId 1", diff --git a/api/app/lib/controllers/alarm/data.js b/api/app/lib/controllers/alarm/data.js index 5253bad..e6afd6c 100644 --- a/api/app/lib/controllers/alarm/data.js +++ b/api/app/lib/controllers/alarm/data.js @@ -194,7 +194,7 @@ async function list (ctx) { } ctx.status = 200; } catch (error) { - ctx.fs.logger.error(`path: ${ctx.path}, error: error`); + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); ctx.status = 400; ctx.body = { message: typeof error == 'string' ? error : undefined diff --git a/api/app/lib/controllers/alarm/video.js b/api/app/lib/controllers/alarm/video.js index d20d85e..05a9645 100644 --- a/api/app/lib/controllers/alarm/video.js +++ b/api/app/lib/controllers/alarm/video.js @@ -1,13 +1,30 @@ '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, @@ -24,6 +41,12 @@ async function alarmList (ctx) { 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) { @@ -35,6 +58,21 @@ async function alarmList (ctx) { } } +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 }; \ No newline at end of file