From bf0b51a0b4123eac3d2cd590be3e4ca12a91265c Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Tue, 1 Nov 2022 17:18:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=91=8A=E8=AD=A6=E6=8E=A8=E9=80=81=E8=AE=B0?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/schedule/alarms_push.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/api/app/lib/schedule/alarms_push.js b/api/app/lib/schedule/alarms_push.js index 8932f58..a436aef 100644 --- a/api/app/lib/schedule/alarms_push.js +++ b/api/app/lib/schedule/alarms_push.js @@ -377,7 +377,7 @@ module.exports = function (app, opts) { dataAlarms = await clickHouse.dataAlarm.query(` SELECT * FROM alarms WHERE - ${/*`'State NOT IN (3, 4) AND '`*/''} + ${`'State NOT IN (3, 4) AND '`} StructureId IN (${searchStrucIds.join(',')}) ${dataAlarmOption.length ? ' AND ' + dataAlarmOption.join(' AND ') : ''} ORDER BY StartTime DESC @@ -674,12 +674,14 @@ module.exports = function (app, opts) { const receiverRes = c.receiverPepUserId.length ? 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() : [] + let receiverId = [] const emails = receiverRes.reduce((arr, r) => { if (r.email) { arr.push(r.email) + receiverId.push(r.id) } return arr }, []) @@ -690,6 +692,14 @@ module.exports = function (app, opts) { text: '', html: html }) + await models.EmailSendLog.create({ + time: moment().format(), + pushConfigId: c.id, + tactics: c.tactics, + tacticsParams: c.tacticsParams, + projectCorrelationId: pomsProjectId, + toPepUserIds: receiverId + }) } } }