From 3c7c836b640fa77cade6b2899b42b925d0ab3279 Mon Sep 17 00:00:00 2001 From: DemoLiang <10086ng@10086ng.com> Date: Wed, 2 Dec 2020 11:38:35 +0800 Subject: [PATCH] =?UTF-8?q?[FIX][issue#433]=E4=BC=98=E5=8C=96=E5=91=8A?= =?UTF-8?q?=E8=AD=A6=E6=94=B6=E6=95=9B=EF=BC=8C=E6=9F=A5=E8=AF=A2=E5=91=8A?= =?UTF-8?q?=E8=AD=A6=E4=BA=8B=E4=BB=B6=E7=BB=9F=E8=AE=A1=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=97=B6=E4=BD=BF=E7=94=A8created=E5=81=9Abe?= =?UTF-8?q?tween=E6=9F=A5=E8=AF=A2=E6=95=B0=E6=8D=AE=E5=BA=93=E6=97=B6?= =?UTF-8?q?=E8=80=97=E6=97=B6=E9=9D=9E=E5=B8=B8=E4=B9=85=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8C=E4=BF=AE=E6=94=B9=E9=97=AE=E4=BD=BF=E7=94=A8?= =?UTF-8?q?etime=20=E5=8F=AF=E4=BB=A5=E5=91=BD=E4=B8=ADetime=E7=B4=A2?= =?UTF-8?q?=E5=BC=95=EF=BC=8C=E6=8F=90=E5=8D=87=E6=9F=A5=E8=AF=A2=E6=80=A7?= =?UTF-8?q?=E8=83=BD=EF=BC=8C4C8G=E6=9F=A5=E8=AF=A2100W=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E5=A4=A7=E6=A6=829s=E8=80=97=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=94=B9=E4=B8=BAetime=E5=A4=A7=E6=A6=82700m?= =?UTF-8?q?s=E8=80=97=E6=97=B6=20(#435)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/mon_event.go | 4 ++-- src/modules/monapi/alarm/event_consumer.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/models/mon_event.go b/src/models/mon_event.go index 41d17a94..7416a1cb 100644 --- a/src/models/mon_event.go +++ b/src/models/mon_event.go @@ -200,8 +200,8 @@ func EventAlertUpgradeUnMarshal(str string) (EventAlertUpgrade, error) { return obj, err } -func EventCnt(hashid uint64, stime, etime string, isUpgrade bool) (int64, error) { - session := DB["mon"].Where("hashid = ? and event_type = ? and created between ? and ?", hashid, config.ALERT, stime, etime) +func EventCnt(hashid uint64, stime, etime int64, isUpgrade bool) (int64, error) { + session := DB["mon"].Where("hashid = ? and event_type = ? and etime between ? and ?", hashid, config.ALERT, stime, etime) if isUpgrade { return session.In("status", GetFlagsByStatus([]string{STATUS_UPGRADE, STATUS_SEND})).Count(new(Event)) diff --git a/src/modules/monapi/alarm/event_consumer.go b/src/modules/monapi/alarm/event_consumer.go index db03c485..0121238e 100644 --- a/src/modules/monapi/alarm/event_consumer.go +++ b/src/modules/monapi/alarm/event_consumer.go @@ -173,7 +173,7 @@ func isInConverge(event *models.Event) bool { startTs = recoveryTs } - cnt, err := models.EventCnt(event.HashId, models.ParseEtime(startTs), models.ParseEtime(now), event.RealUpgrade) + cnt, err := models.EventCnt(event.HashId, startTs, now, event.RealUpgrade) if err != nil { logger.Errorf("get event count failed, err: %v", err) return false