巴林闲侠 2 years ago
parent
commit
8914cca35a
  1. 9
      api/app/lib/controllers/alarm/data.js
  2. 30
      api/app/lib/controllers/alarm/video.js
  3. 2
      web/client/index.ejs

9
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 => {

30
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 = {
};

2
web/client/index.ejs

@ -5,7 +5,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="minimum-scale=1, initial-scale=1, width=device-width" />
<meta content="upgrade-insecure-requests" http-equiv="Content-Security-Policy">
<!-- <meta content="upgrade-insecure-requests" http-equiv="Content-Security-Policy"> -->
<link rel="shortcut icon" href="/assets/images/favicon.ico">
<script charset="UTF-8" id="LA_COLLECT" src="//sdk.51.la/js-sdk-pro.min.js"></script>

Loading…
Cancel
Save