From 230750817d67fc4cf39941ed5be16b98515ee1f3 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Thu, 3 Nov 2022 14:56:37 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AD=96=E7=95=A5=E5=88=A4=E9=87=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/push/config.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/api/app/lib/controllers/push/config.js b/api/app/lib/controllers/push/config.js index 21c630a..630b649 100644 --- a/api/app/lib/controllers/push/config.js +++ b/api/app/lib/controllers/push/config.js @@ -171,6 +171,20 @@ async function edit (ctx) { name, pomsProjectId, alarmType, receiverPepUserId, timeType, disable, strucId, tactics, tacticsParams } + + let repeatOption = { + where: { + name, + del: false, + } + } + if (pushId) { + repeatOption.where.id = { $ne: pushId } + } + if (repeatOption) { + throw `已有名称为[${name}]的同名策略` + } + let repeatRes = await models.findOne(repeatOption) if (pushId) { await models.AlarmPushConfig.update(storageData, { where: {