fix 随机数转化异常

This commit is contained in:
ZJY 2021-09-14 20:57:54 +08:00
parent 0e24c20871
commit 63f76fb281

View File

@ -5,13 +5,14 @@ import (
"github.com/beego/beego/v2/core/logs"
"github.com/robfig/cron/v3"
"math/rand"
"strconv"
)
func intiSky() {
c := cron.New(cron.WithSeconds()) //精确到秒
//定时任务
spec := "0 " + string(rand.Intn(59)) + " " + Config.CTime + "/12 * * ?" //cron表达式每秒一次
spec := "0 " + strconv.Itoa(rand.Intn(59)) + " " + Config.CTime + "/12 * * ?" //cron表达式每秒一次
logs.Info(spec)
c.AddFunc(spec, func() {
fmt.Println("开始wskey转换")