Browse Source

视频告警记录至运维平台

dev_trial
巴林闲侠 2 years ago
parent
commit
2b77ef4cfe
  1. 18
      code/VideoAccess-VCMP/api/app/lib/controllers/status/alarm.js
  2. 11
      code/VideoAccess-VCMP/api/config.js

18
code/VideoAccess-VCMP/api/app/lib/controllers/status/alarm.js

@ -63,14 +63,30 @@ async function record (ctx) {
} }
}) })
} else if (!isRestore) { } else if (!isRestore) {
const createTime = moment().format('YYYY-MM-DD HH:mm:ss');
alarmRes = await models.CameraStatusAlarm.create({ alarmRes = await models.CameraStatusAlarm.create({
statusId: statusRes.id, statusId: statusRes.id,
description, description,
createTime: moment().format('YYYY-MM-DD HH:mm:ss'), createTime: createTime,
serialNo, serialNo,
channelNo, channelNo,
platform, platform,
}) })
try {
ctx.app.fs.pomsRequest.post(`alarm/video/added_log`, {
data: {
serial_no: serialNo,
channel_no: channelNo,
create_time: createTime,
description: description,
status_id: statusRes.id,
}
})
} catch (error) {
ctx.fs.logger.error(` error: ${error}`);
}
} }
ctx.status = 204; ctx.status = 204;

11
code/VideoAccess-VCMP/api/config.js

@ -18,6 +18,7 @@ args.option('redisPswd', 'redisPassword');
args.option('axyApiUrl', '安心云 api'); args.option('axyApiUrl', '安心云 api');
args.option('iotAuthApi', 'IOT 鉴权 api'); args.option('iotAuthApi', 'IOT 鉴权 api');
args.option('pomsApiUrl', '运维平台 api')
args.option('godUrl', '高德地图API请求地址'); args.option('godUrl', '高德地图API请求地址');
args.option('godKey', '高德地图API key'); args.option('godKey', '高德地图API key');
@ -44,6 +45,8 @@ const IOTA_REDIS_SERVER_PWD = process.env.IOTA_REDIS_SERVER_PWD || flags.redisPs
const IOT_AUTH_API = process.env.IOT_AUTH_API || flags.iotAuthApi; const IOT_AUTH_API = process.env.IOT_AUTH_API || flags.iotAuthApi;
// 安心云api // 安心云api
const AXY_API_URL = process.env.AXY_API_URL || flags.axyApiUrl; const AXY_API_URL = process.env.AXY_API_URL || flags.axyApiUrl;
// 运维平台 api
const POMS_API_URL = process.env.POMS_API_URL || flags.pomsApiUrl;
// 高德地图的参数 // 高德地图的参数
const GOD_URL = process.env.GOD_URL || flags.godUrl || 'https://restapi.amap.com/v3'; const GOD_URL = process.env.GOD_URL || flags.godUrl || 'https://restapi.amap.com/v3';
@ -64,8 +67,9 @@ const CAMERA_PLAY_HLS_HOST = process.env.CAMERA_PLAY_HLS_HOST || flags.cameraPla
const CAMERA_PLAY_RTMP_HOST = process.env.CAMERA_PLAY_RTMP_HOST || flags.cameraPlayRtmpHost; const CAMERA_PLAY_RTMP_HOST = process.env.CAMERA_PLAY_RTMP_HOST || flags.cameraPlayRtmpHost;
const CAMERA_PLAY_RTSP_HOST = process.env.CAMERA_PLAY_RTSP_HOST || flags.cameraPlayRtspHost; const CAMERA_PLAY_RTSP_HOST = process.env.CAMERA_PLAY_RTSP_HOST || flags.cameraPlayRtspHost;
if (!IOT_VIDEO_ACCESS_DB || !IOTA_REDIS_SERVER_HOST || !IOTA_REDIS_SERVER_PORT || !GOD_KEY || !MQTT_VIDEO_SERVER || if (
!AXY_API_URL || !IOT_VIDEO_SERVER_URL || !IOT_AUTH_API || !IOT_VIDEO_ACCESS_DB || !IOTA_REDIS_SERVER_HOST || !IOTA_REDIS_SERVER_PORT || !GOD_KEY || !MQTT_VIDEO_SERVER ||
!AXY_API_URL || !IOT_VIDEO_SERVER_URL || !IOT_AUTH_API || !POMS_API_URL ||
!CAMERA_PLAY_WS_HOST || !CAMERA_PLAY_HTTP_FLV_HOST || !CAMERA_PLAY_HLS_HOST || !CAMERA_PLAY_RTMP_HOST || !CAMERA_PLAY_RTSP_HOST !CAMERA_PLAY_WS_HOST || !CAMERA_PLAY_HTTP_FLV_HOST || !CAMERA_PLAY_HLS_HOST || !CAMERA_PLAY_RTMP_HOST || !CAMERA_PLAY_RTSP_HOST
) { ) {
console.log('缺少启动参数,异常退出'); console.log('缺少启动参数,异常退出');
@ -136,6 +140,9 @@ const product = {
}, { }, {
name: 'axyRequest', name: 'axyRequest',
root: AXY_API_URL root: AXY_API_URL
}, {
name: 'pomsRequest',
root: POMS_API_URL
}, { }, {
name: 'godRequest', name: 'godRequest',
root: GOD_URL, root: GOD_URL,

Loading…
Cancel
Save