From e1bdd215b1c5106b371466162b72d10e4dd28a4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=98=AD?= <81747598+lan-yonghui@users.noreply.github.com> Date: Thu, 14 Nov 2024 21:52:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BC=96=E8=BE=91=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=92=8C=E7=97=85=E6=AF=92=E6=89=AB=E6=8F=8F?= =?UTF-8?q?=E5=91=8A=E8=AD=A6=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86=20(#7058?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/clam.go | 20 +++++++++----------- backend/app/service/cronjob.go | 20 +++++++++----------- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/backend/app/service/clam.go b/backend/app/service/clam.go index f318105f7..cb1b82a15 100644 --- a/backend/app/service/clam.go +++ b/backend/app/service/clam.go @@ -249,17 +249,15 @@ func (c *ClamService) Update(req dto.ClamUpdate) error { if err := clamRepo.Update(req.ID, upMap); err != nil { return err } - if req.AlertCount != 0 { - updateAlert := dto.CreateOrUpdateAlert{ - AlertTitle: req.AlertTitle, - AlertType: "clams", - AlertCount: req.AlertCount, - EntryID: clam.ID, - } - err := xpack.UpdateAlert(updateAlert) - if err != nil { - return err - } + updateAlert := dto.CreateOrUpdateAlert{ + AlertTitle: req.AlertTitle, + AlertType: "clams", + AlertCount: req.AlertCount, + EntryID: clam.ID, + } + err := xpack.UpdateAlert(updateAlert) + if err != nil { + return err } return nil } diff --git a/backend/app/service/cronjob.go b/backend/app/service/cronjob.go index 2f700a3c3..81dee96fa 100644 --- a/backend/app/service/cronjob.go +++ b/backend/app/service/cronjob.go @@ -316,17 +316,15 @@ func (u *CronjobService) Update(id uint, req dto.CronjobUpdate) error { if err != nil { return err } - if req.AlertCount != 0 { - updateAlert := dto.CreateOrUpdateAlert{ - AlertTitle: req.AlertTitle, - AlertType: cronModel.Type, - AlertCount: req.AlertCount, - EntryID: cronModel.ID, - } - err = xpack.UpdateAlert(updateAlert) - if err != nil { - return err - } + updateAlert := dto.CreateOrUpdateAlert{ + AlertTitle: req.AlertTitle, + AlertType: cronModel.Type, + AlertCount: req.AlertCount, + EntryID: cronModel.ID, + } + err = xpack.UpdateAlert(updateAlert) + if err != nil { + return err } return nil }