add 修复wskey不会定时转换问题
This commit is contained in:
parent
2b0a8f9a51
commit
4f73b7b2f4
@ -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() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user