From a25a1b128d96bff5f4adb80c62c65974b82787c8 Mon Sep 17 00:00:00 2001 From: naiba Date: Thu, 30 Sep 2021 11:59:57 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E6=94=B9=E8=AE=A1?= =?UTF-8?q?=E5=88=92=E4=BB=BB=E5=8A=A1=E5=B9=B6=E6=9C=AA=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E6=97=A7=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- cmd/dashboard/controller/member_api.go | 11 +++++------ cmd/dashboard/main.go | 2 +- model/cron.go | 2 +- service/dao/dao.go | 2 +- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 02d67d5..8418e7a 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@
LOGO designed by 熊大 .

-    +   

:trollface: 哪吒监控 一站式轻监控轻运维系统。支持系统状态、HTTP(SSL 证书变更、即将到期、到期)、TCP、Ping 监控报警,命令批量执行和计划任务。

diff --git a/cmd/dashboard/controller/member_api.go b/cmd/dashboard/controller/member_api.go index a195237..5abb35e 100644 --- a/cmd/dashboard/controller/member_api.go +++ b/cmd/dashboard/controller/member_api.go @@ -10,7 +10,6 @@ import ( "time" "github.com/gin-gonic/gin" - "github.com/robfig/cron/v3" "github.com/naiba/nezha/model" "github.com/naiba/nezha/pkg/mygin" @@ -82,8 +81,8 @@ func (ma *memberAPI) delete(c *gin.Context) { dao.CronLock.RLock() defer dao.CronLock.RUnlock() cr := dao.Crons[id] - if cr != nil && cr.CronID != 0 { - dao.Cron.Remove(cr.CronID) + if cr != nil && cr.CronJobID != 0 { + dao.Cron.Remove(cr.CronJobID) } delete(dao.Crons, id) } @@ -276,7 +275,7 @@ func (ma *memberAPI) addOrEditCron(c *gin.Context) { } } if err == nil { - cr.CronID, err = dao.Cron.AddFunc(cr.Scheduler, dao.CronTrigger(cr)) + cr.CronJobID, err = dao.Cron.AddFunc(cr.Scheduler, dao.CronTrigger(cr)) } if err == nil { err = tx.Commit().Error @@ -294,8 +293,8 @@ func (ma *memberAPI) addOrEditCron(c *gin.Context) { dao.CronLock.Lock() defer dao.CronLock.Unlock() crOld := dao.Crons[cr.ID] - if crOld != nil && crOld.CronID != 0 { - dao.Cron.Remove(cron.EntryID(crOld.ID)) + if crOld != nil && crOld.CronJobID != 0 { + dao.Cron.Remove(crOld.CronJobID) } delete(dao.Crons, cr.ID) diff --git a/cmd/dashboard/main.go b/cmd/dashboard/main.go index fe6cb58..698889c 100644 --- a/cmd/dashboard/main.go +++ b/cmd/dashboard/main.go @@ -165,7 +165,7 @@ func loadCrons() { crIgnoreMap[cr.Servers[j]] = true } - cr.CronID, err = dao.Cron.AddFunc(cr.Scheduler, dao.CronTrigger(cr)) + cr.CronJobID, err = dao.Cron.AddFunc(cr.Scheduler, dao.CronTrigger(cr)) if err == nil { dao.Crons[cr.ID] = &cr } else { diff --git a/model/cron.go b/model/cron.go index c03b7f0..043199f 100644 --- a/model/cron.go +++ b/model/cron.go @@ -24,7 +24,7 @@ type Cron struct { LastResult bool // 最后一次执行结果 Cover uint8 - CronID cron.EntryID `gorn:"-"` + CronJobID cron.EntryID `gorn:"-"` ServersRaw string } diff --git a/service/dao/dao.go b/service/dao/dao.go index e00704f..3d7ec13 100644 --- a/service/dao/dao.go +++ b/service/dao/dao.go @@ -13,7 +13,7 @@ import ( pb "github.com/naiba/nezha/proto" ) -var Version = "v0.10.3" // !!记得修改 README 中的 badge 版本!! +var Version = "v0.10.4" // !!记得修改 README 中的 badge 版本!! var ( Conf *model.Config