|
@ -377,7 +377,7 @@ module.exports = function (app, opts) { |
|
|
dataAlarms = await clickHouse.dataAlarm.query(` |
|
|
dataAlarms = await clickHouse.dataAlarm.query(` |
|
|
SELECT * FROM alarms |
|
|
SELECT * FROM alarms |
|
|
WHERE |
|
|
WHERE |
|
|
${/*`'State NOT IN (3, 4) AND '`*/''} |
|
|
${`'State NOT IN (3, 4) AND '`} |
|
|
StructureId IN (${searchStrucIds.join(',')}) |
|
|
StructureId IN (${searchStrucIds.join(',')}) |
|
|
${dataAlarmOption.length ? ' AND ' + dataAlarmOption.join(' AND ') : ''} |
|
|
${dataAlarmOption.length ? ' AND ' + dataAlarmOption.join(' AND ') : ''} |
|
|
ORDER BY StartTime DESC |
|
|
ORDER BY StartTime DESC |
|
@ -674,12 +674,14 @@ module.exports = function (app, opts) { |
|
|
const receiverRes = |
|
|
const receiverRes = |
|
|
c.receiverPepUserId.length ? |
|
|
c.receiverPepUserId.length ? |
|
|
await clickHouse.pepEmis.query(` |
|
|
await clickHouse.pepEmis.query(` |
|
|
SELECT email FROM user WHERE id IN (${c.receiverPepUserId.join(',')},-1) |
|
|
SELECT id, email FROM user WHERE id IN (${c.receiverPepUserId.join(',')},-1) |
|
|
`).toPromise()
|
|
|
`).toPromise()
|
|
|
: [] |
|
|
: [] |
|
|
|
|
|
let receiverId = [] |
|
|
const emails = receiverRes.reduce((arr, r) => { |
|
|
const emails = receiverRes.reduce((arr, r) => { |
|
|
if (r.email) { |
|
|
if (r.email) { |
|
|
arr.push(r.email) |
|
|
arr.push(r.email) |
|
|
|
|
|
receiverId.push(r.id) |
|
|
} |
|
|
} |
|
|
return arr |
|
|
return arr |
|
|
}, []) |
|
|
}, []) |
|
@ -690,6 +692,14 @@ module.exports = function (app, opts) { |
|
|
text: '', |
|
|
text: '', |
|
|
html: html |
|
|
html: html |
|
|
}) |
|
|
}) |
|
|
|
|
|
await models.EmailSendLog.create({ |
|
|
|
|
|
time: moment().format(), |
|
|
|
|
|
pushConfigId: c.id, |
|
|
|
|
|
tactics: c.tactics, |
|
|
|
|
|
tacticsParams: c.tacticsParams, |
|
|
|
|
|
projectCorrelationId: pomsProjectId, |
|
|
|
|
|
toPepUserIds: receiverId |
|
|
|
|
|
}) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|