wenlele 2 years ago
parent
commit
90301dacc9
  1. 18
      api/app/lib/controllers/alarm/video.js
  2. 3
      api/app/lib/controllers/project/index.js
  3. 2
      api/app/lib/schedule/alarms_handle_statistics.js

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

@ -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

3
api/app/lib/controllers/project/index.js

@ -137,7 +137,8 @@ async function projectPManage (ctx) {
const bindedPRes = await models.ProjectCorrelation.findAll({ const bindedPRes = await models.ProjectCorrelation.findAll({
where: { where: {
pepProjectId: { $ne: null } pepProjectId: { $ne: null },
del: false
} }
}) })

2
api/app/lib/schedule/alarms_handle_statistics.js

@ -7,7 +7,7 @@ module.exports = function (app, opts) {
const { database: anxinyun } = clickHouse.anxinyun.opts.config const { database: anxinyun } = clickHouse.anxinyun.opts.config
const alarmHandleStatistics = app.fs.scheduleInit( const alarmHandleStatistics = app.fs.scheduleInit(
{ {
interval: '0 18 1 ? * 3',//每周一1点18触发 interval: '0 18 1 ? * 1',//每周一1点18触发
// immediate: true, // immediate: true,
proRun: true, proRun: true,
}, },

Loading…
Cancel
Save