From 0ef8bd183a9e9878b287459ad45f4cc574a21264 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Mon, 8 Aug 2022 16:50:05 +0800 Subject: [PATCH] cameraOnlinePush --- .../api/app/lib/schedule/cameraStatePush.js | 10 ++++++---- .../api/app/lib/schedule/freshYingshiMsg.js | 3 ++- code/VideoAccess-VCMP/api/config.js | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/code/VideoAccess-VCMP/api/app/lib/schedule/cameraStatePush.js b/code/VideoAccess-VCMP/api/app/lib/schedule/cameraStatePush.js index 6238a40..0291207 100644 --- a/code/VideoAccess-VCMP/api/app/lib/schedule/cameraStatePush.js +++ b/code/VideoAccess-VCMP/api/app/lib/schedule/cameraStatePush.js @@ -4,9 +4,10 @@ module.exports = function (app, opts) { const cameraOnlinePush = app.fs.scheduleInit( { interval: '* */15 * * * *', - interval: '*/15 * * * * *', + // interval: '* */1 * * * *', + // interval: '* */5 * * * *', immediate: false, - proRun: true, + // proRun: true, }, async () => { try { @@ -39,7 +40,7 @@ module.exports = function (app, opts) { const offlineStatusRes = await models.CameraStatusOfflineLog.findAll({ where: { cameraId: { $in: cameraIds }, - + // time: { // $between: [moment(timeNow).subtract(15, 'minutes').format(), timeNow] // } @@ -119,11 +120,12 @@ module.exports = function (app, opts) { // camera: cameraIds, } // 离线推送 + console.log('object'); if (offArr.length && c.noticeWay && c.noticeWay.includes('offline')) { if (c.pushWay == 'email') { // 邮件 let text = `【${corUser[0].username}】账号下的设备,截止【${moment(timeNow).format('MM月DD日 HH时mm分')}】,有${offArr.length}个设备掉线:\n` - text += offArr.map(o => `【${o.name}】于【${o.time}】掉线,`).join('\n') + text += offArr.map(o => `【${o.name}】于【${moment(o.time).format('MM月DD日 HH时mm分')}】掉线,`).join('\n') text += `\n请及时处理!` await pushByEmail({ email: receiver, diff --git a/code/VideoAccess-VCMP/api/app/lib/schedule/freshYingshiMsg.js b/code/VideoAccess-VCMP/api/app/lib/schedule/freshYingshiMsg.js index 31c3424..0d2de0b 100644 --- a/code/VideoAccess-VCMP/api/app/lib/schedule/freshYingshiMsg.js +++ b/code/VideoAccess-VCMP/api/app/lib/schedule/freshYingshiMsg.js @@ -7,6 +7,7 @@ module.exports = function (app, opts) { interval: '* */5 * * * *', // interval: '*/10 * * * *', immediate: false, + // immediate: true, proRun: true, }, async () => { @@ -43,7 +44,7 @@ module.exports = function (app, opts) { level: 0, ipctype: 'yingshi', streamid: d.deviceSerial, - online: d.status ? 'ON' : 'OFF', + online: d.status == 1 ? 'ON' : 'OFF', name: d.deviceName, } if (existD) { diff --git a/code/VideoAccess-VCMP/api/config.js b/code/VideoAccess-VCMP/api/config.js index 00e5f2e..014e51c 100644 --- a/code/VideoAccess-VCMP/api/config.js +++ b/code/VideoAccess-VCMP/api/config.js @@ -120,8 +120,8 @@ const product = { port: 465, sender: { name: '尚视', - address: 'no-reply@zhiwucloud.com', - password: 'Zwy123456_' + address: 'fsiot@free-sun.com.cn', + password: 'Fs2689' } }, pssaRequest: [