Browse Source

SubDevices

dev
CODE 1 year ago
parent
commit
31da6d9c01
  1. 14
      api/app/lib/schedule/alarms_push.js

14
api/app/lib/schedule/alarms_push.js

@ -1243,7 +1243,8 @@ module.exports = function (app, opts) {
alarms.SourceName AS SourceName, alarms.SourceName AS SourceName,
alarms.AlarmCode AS AlarmCode, alarms.AlarmCode AS AlarmCode,
alarms.SourceTypeId AS SourceTypeId, alarms.SourceTypeId AS SourceTypeId,
alarms.StructureId AS StructureId alarms.StructureId AS StructureId,
alarms.SubDevices AS SubDevices
FROM FROM
alarms alarms
WHERE WHERE
@ -1253,17 +1254,16 @@ module.exports = function (app, opts) {
AND AND
alarms.State < 3 alarms.State < 3
` `
// ,
// alarms.subStations AS subStations
).toPromise() || [] ).toPromise() || []
let alarmDatas = [] let alarmDatas = []
for (let alarms of alarmDataRes) { for (let alarms of alarmDataRes) {
if (alarms.subStations && alarms.subStations.length) { if (alarms.SubDevices && alarms.SubDevices.length) {
pLog('拆解 subStations' + alarms.alarmId + ' ' + alarms.subStations.length + '个') pLog('拆解 SubDevices' + alarms.alarmId + ' ' + alarms.SubDevices.length + '个')
for (let subStation of alarms.subStations) { for (let SubDevice of alarms.SubDevices) {
alarmDatas.push({ alarmDatas.push({
...alarms, ...alarms,
alarmId: subStation alarmId: SubDevice
}) })
} }
} else { } else {

Loading…
Cancel
Save