From 4f73b7b2f45dced6dc478e6d591b2e4c0c330481 Mon Sep 17 00:00:00 2001 From: ZJY <764763903@qq.com> Date: Thu, 30 Sep 2021 15:53:14 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E4=BF=AE=E5=A4=8Dwskey=E4=B8=8D=E4=BC=9A?= =?UTF-8?q?=E5=AE=9A=E6=97=B6=E8=BD=AC=E6=8D=A2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/wskey.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/models/wskey.go b/models/wskey.go index 61e5178..b6cd122 100644 --- a/models/wskey.go +++ b/models/wskey.go @@ -4,13 +4,15 @@ import ( "fmt" "github.com/beego/beego/v2/core/logs" "github.com/robfig/cron/v3" + "math/rand" + "strconv" ) func intiSky() { c := cron.New(cron.WithSeconds()) //精确到秒 //定时任务 - spec := "0 0" + " " + Config.CTime + "/12 * * ?" //cron表达式,每秒一次 + spec := "0 " + strconv.Itoa(rand.Intn(59)) + " " + Config.CTime + "/12 * * ?" //cron表达式,每秒一次 logs.Info(spec) if Config.Wskey { c.AddFunc(spec, func() {