xdd-plus/models/wskey.go

20 lines
302 B
Go
Raw Normal View History

2021-09-07 00:42:47 +08:00
package models
import (
2021-09-07 01:19:40 +08:00
"fmt"
"github.com/robfig/cron/v3"
2021-09-07 00:42:47 +08:00
)
2021-09-07 01:19:40 +08:00
func intiSky() {
c := cron.New(cron.WithSeconds()) //精确到秒
2021-09-07 01:12:57 +08:00
2021-09-07 01:19:40 +08:00
//定时任务
2021-09-07 09:12:44 +08:00
spec := "0 0 10/12 * * ?" //cron表达式每秒一次
2021-09-07 01:19:40 +08:00
c.AddFunc(spec, func() {
fmt.Println("开始wskey转换")
2021-09-07 09:12:44 +08:00
updateCookie()
2021-09-07 01:19:40 +08:00
})
2021-09-07 01:12:57 +08:00
2021-09-07 01:19:40 +08:00
c.Start()
2021-09-07 01:12:57 +08:00
}