测试定时器
This commit is contained in:
parent
21791fccac
commit
007b145e15
@ -1,16 +1,15 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/beego/beego/v2/core/logs"
|
||||
"github.com/robfig/cron/v3"
|
||||
)
|
||||
|
||||
func intiSky() {
|
||||
log.Println("Starting...")
|
||||
logs.Info("Starting...")
|
||||
c := cron.New() // 新建一个定时任务对象
|
||||
c.AddFunc("0 59 0/12 * * *", func() {
|
||||
log.Println("hello world")
|
||||
c.AddFunc("0 3 1 * * *", func() {
|
||||
logs.Info("hello world")
|
||||
}) // 给对象增加定时任务
|
||||
c.Start()
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user