Browse Source

优化推送逻辑

release_1.1.2
巴林闲侠 2 years ago
parent
commit
0a8e9ad4f0
  1. 24
      code/VideoAccess-VCMP/api/app/lib/schedule/cameraStatePush.js

24
code/VideoAccess-VCMP/api/app/lib/schedule/cameraStatePush.js

@ -127,12 +127,12 @@ module.exports = function (app, opts) {
let text = `${corUser[0].username}】账号下的设备,截止【${moment(timeNow).format('MM月DD日 HH时mm分')}】,有${offArr.length}个设备掉线:\n`
text += offArr.map(o => `${o.name}】于【${moment(o.time).format('MM月DD日 HH时mm分')}】掉线,`).join('\n')
text += `\n请及时处理!`
// await pushByEmail({
// email: receiver,
// title: '尚视设备离线通知',
// text,
// })
// await models.CameraStatusPushLog.create({ ...logData, pushWay: 'email', noticeWay: ['offline'], camera: offArr.map(o => o.cameraId) })
await pushByEmail({
email: receiver,
title: '尚视设备离线通知',
text,
})
await models.CameraStatusPushLog.create({ ...logData, pushWay: 'email', noticeWay: ['offline'], camera: offArr.map(o => o.cameraId) })
} else if (c.pushWay == 'phone') {
// 短信
let templateParam = {
@ -196,12 +196,12 @@ module.exports = function (app, opts) {
let text = `${corUser[0].username}】账号下的设备:\n`
text += onArr.map(o => `${o.name}】于【${moment(o.offTime).format('MM月DD日HH时mm分')}】掉线,【${moment(o.time).format('MM月DD日HH时mm分')}】已恢复`).join('\n')
// await pushByEmail({
// email: receiver,
// title: '尚视设备上线通知',
// text,
// })
// await models.CameraStatusPushLog.create({ ...logData, pushWay: 'email', noticeWay: ['online'], camera: onArr.map(o => o.cameraId) })
await pushByEmail({
email: receiver,
title: '尚视设备上线通知',
text,
})
await models.CameraStatusPushLog.create({ ...logData, pushWay: 'email', noticeWay: ['online'], camera: onArr.map(o => o.cameraId) })
} else if (c.pushWay == 'phone') {
// 短信
// let text = `【${corUser[0].username}】账号下的`

Loading…
Cancel
Save