From 092b886be4e6a40d3d2b01bc3c682814c4d28e1a Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Thu, 3 Nov 2022 15:11:12 +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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/app/lib/controllers/push/config.js b/api/app/lib/controllers/push/config.js index 630b649..2b50ee4 100644 --- a/api/app/lib/controllers/push/config.js +++ b/api/app/lib/controllers/push/config.js @@ -181,10 +181,11 @@ async function edit (ctx) { if (pushId) { repeatOption.where.id = { $ne: pushId } } - if (repeatOption) { + let repeatRes = await models.findOne(repeatOption) + if (repeatRes) { throw `已有名称为[${name}]的同名策略` } - let repeatRes = await models.findOne(repeatOption) + if (pushId) { await models.AlarmPushConfig.update(storageData, { where: {