|
@ -1,7 +1,7 @@ |
|
|
'use strict'; |
|
|
'use strict'; |
|
|
const moment = require('moment') |
|
|
const moment = require('moment') |
|
|
const { alarmConfirmLog } = require('./alarmConfirmLog'); |
|
|
const { alarmConfirmLog } = require('./alarmConfirmLog'); |
|
|
async function deviceType(ctx) { |
|
|
async function deviceType (ctx) { |
|
|
try { |
|
|
try { |
|
|
const { models } = ctx.fs.dc; |
|
|
const { models } = ctx.fs.dc; |
|
|
const { clickHouse } = ctx.app.fs |
|
|
const { clickHouse } = ctx.app.fs |
|
@ -21,7 +21,7 @@ async function deviceType(ctx) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function alarmList(ctx) { |
|
|
async function alarmList (ctx) { |
|
|
try { |
|
|
try { |
|
|
const { models } = ctx.fs.dc; |
|
|
const { models } = ctx.fs.dc; |
|
|
const { clickHouse } = ctx.app.fs |
|
|
const { clickHouse } = ctx.app.fs |
|
@ -46,7 +46,11 @@ async function alarmList(ctx) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (kindId) { |
|
|
if (kindId) { |
|
|
cameraWhereOption.push(`camera.kind_id = ${kindId}`) |
|
|
let sql = `camera.kind_id = ${kindId}` |
|
|
|
|
|
if (kindId == 1314) { |
|
|
|
|
|
sql = `(camera.kind_id = ${kindId} OR camera.kind_id IS null)` |
|
|
|
|
|
} |
|
|
|
|
|
cameraWhereOption.push(sql) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
let statusAlarmWhereOption = [] |
|
|
let statusAlarmWhereOption = [] |
|
@ -262,7 +266,7 @@ async function alarmList(ctx) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function confirm(ctx) { |
|
|
async function confirm (ctx) { |
|
|
try { |
|
|
try { |
|
|
const { alarmId, content, confirmPost } = ctx.request.body; |
|
|
const { alarmId, content, confirmPost } = ctx.request.body; |
|
|
// TODO: 以视频·应用的秘钥进行鉴权
|
|
|
// TODO: 以视频·应用的秘钥进行鉴权
|
|
@ -288,7 +292,7 @@ let structsAche = { |
|
|
dataList: [], |
|
|
dataList: [], |
|
|
expireTime: null//10分钟更新一次结构物列表
|
|
|
expireTime: null//10分钟更新一次结构物列表
|
|
|
} |
|
|
} |
|
|
async function getStructsAche(ctx) { |
|
|
async function getStructsAche (ctx) { |
|
|
const { utils: { getAxyStructs } } = ctx.app.fs |
|
|
const { utils: { getAxyStructs } } = ctx.app.fs |
|
|
try { |
|
|
try { |
|
|
if (!structsAche.dataList.length || moment() > moment(structsAche.expireTime)) { |
|
|
if (!structsAche.dataList.length || moment() > moment(structsAche.expireTime)) { |
|
@ -302,7 +306,7 @@ async function getStructsAche(ctx) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function alarmAdded(ctx) { |
|
|
async function alarmAdded (ctx) { |
|
|
try { |
|
|
try { |
|
|
const { models } = ctx.fs.dc; |
|
|
const { models } = ctx.fs.dc; |
|
|
const { clickHouse } = ctx.app.fs |
|
|
const { clickHouse } = ctx.app.fs |
|
@ -362,7 +366,7 @@ async function alarmAdded(ctx) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function vcmpAppAuthToken(ctx) { |
|
|
async function vcmpAppAuthToken (ctx) { |
|
|
try { |
|
|
try { |
|
|
const { models } = ctx.fs.dc; |
|
|
const { models } = ctx.fs.dc; |
|
|
const { utils: { vcmpAuth } } = ctx.app.fs |
|
|
const { utils: { vcmpAuth } } = ctx.app.fs |
|
|