diff --git a/code/VideoAccess-VCMP/api/app/lib/controllers/status/alarm.js b/code/VideoAccess-VCMP/api/app/lib/controllers/status/alarm.js index 7fcfd82..7b49b8f 100644 --- a/code/VideoAccess-VCMP/api/app/lib/controllers/status/alarm.js +++ b/code/VideoAccess-VCMP/api/app/lib/controllers/status/alarm.js @@ -63,14 +63,30 @@ async function record (ctx) { } }) } else if (!isRestore) { + const createTime = moment().format('YYYY-MM-DD HH:mm:ss'); alarmRes = await models.CameraStatusAlarm.create({ statusId: statusRes.id, description, - createTime: moment().format('YYYY-MM-DD HH:mm:ss'), + createTime: createTime, serialNo, channelNo, 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; diff --git a/code/VideoAccess-VCMP/api/config.js b/code/VideoAccess-VCMP/api/config.js index 71511bb..b551f6f 100644 --- a/code/VideoAccess-VCMP/api/config.js +++ b/code/VideoAccess-VCMP/api/config.js @@ -18,6 +18,7 @@ args.option('redisPswd', 'redisPassword'); args.option('axyApiUrl', '安心云 api'); args.option('iotAuthApi', 'IOT 鉴权 api'); +args.option('pomsApiUrl', '运维平台 api') args.option('godUrl', '高德地图API请求地址'); 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; // 安心云api 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'; @@ -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_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 || - !AXY_API_URL || !IOT_VIDEO_SERVER_URL || !IOT_AUTH_API || +if ( + !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 ) { console.log('缺少启动参数,异常退出'); @@ -136,6 +140,9 @@ const product = { }, { name: 'axyRequest', root: AXY_API_URL + }, { + name: 'pomsRequest', + root: POMS_API_URL }, { name: 'godRequest', root: GOD_URL,