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

18
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
@ -34,7 +44,7 @@ async function alarmList (ctx) {
const { clickHouse } = ctx.app.fs
const { utils: { judgeSuper, anxinStrucIdRange } } = ctx.app.fs
const { database: anxinyun } = clickHouse.anxinyun.opts.config
const { pepProjectId, keywordTarget, keyword, state, kindId, sustainTimeStart, sustainTimeEnd, limit, page, statusId, toExport} = ctx.query
const { pepProjectId, keywordTarget, keyword, state, kindId, sustainTimeStart, sustainTimeEnd, limit, page, statusId, toExport } = ctx.query
let anxinStruc = await anxinStrucIdRange({
ctx, pepProjectId, keywordTarget, keyword
@ -78,7 +88,7 @@ async function alarmList (ctx) {
)
`)
}
if(statusId){
if (statusId) {
statusAlarmWhereOption.push(`camera_status_alarm.status_id = ${statusId}`)
}
@ -279,7 +289,7 @@ async function alarmList (ctx) {
}
}
async function exportVideoAlarms(ctx, alarmList) {
async function exportVideoAlarms (ctx, alarmList) {
let accessType = { yingshi: "萤石云", nvr: "NVR", ipc: "IPC", cascade: "级联" }
try {
const { clickHouse, utils: { simpleExcelDown, getExportAlarmHeader } } = ctx.app.fs;
@ -328,7 +338,7 @@ async function exportVideoAlarms(ctx, alarmList) {
}
}
}
async function confirm(ctx) {
async function confirm (ctx) {
try {
const { alarmId, content, confirmPost } = ctx.request.body;
// TODO: 以视频·应用的秘钥进行鉴权

Loading…
Cancel
Save