wenlele 2 years ago
parent
commit
9fe2600b5a
  1. 10
      api/app/lib/controllers/alarm/video.js

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

@ -6,6 +6,12 @@ async function deviceType (ctx) {
try {
const { models } = ctx.fs.dc;
const { clickHouse } = ctx.app.fs
const { database: anxinyun } = clickHouse.anxinyun.opts.config
const { utils: { judgeSuper, anxinStrucIdRange } } = ctx.app.fs
let anxinStruc = await anxinStrucIdRange({
ctx,
})
const anxinStrucIds = anxinStruc.map(a => a.strucId)
const kindRes = await clickHouse.vcmp.query(`
SELECT DISTINCT
@ -16,6 +22,10 @@ async function deviceType (ctx) {
INNER JOIN camera_status_alarm
ON camera.channel_no = camera_status_alarm.channel_no
AND camera.serial_no = camera_status_alarm.serial_no
INNER JOIN ${anxinyun}.t_video_ipc
ON toString(${anxinyun}.t_video_ipc.channel_no) = camera_status_alarm.channel_no
AND ${anxinyun}.t_video_ipc.serial_no = camera_status_alarm.serial_no
${`WHERE ${anxinyun}.t_video_ipc.structure IN (${anxinStrucIds.join(',')})`}
`).toPromise()
ctx.status = 200;
ctx.body = kindRes

Loading…
Cancel
Save