package utils import ( "github.com/robfig/cron" "server/task" ) func ScheduledTask() { c := cron.New() //每五分钟监测状态 _ = c.AddFunc("0 */5 * * * ?", func() { //_ = c.AddFunc("0/10 * * * * ?", func() { //巡检网关 task.GatewayRoutingInspection() }) // 添加每天8:00和18:00的任务 _ = c.AddFunc("0 0 8 * * ? ", func() { //_ = c.AddFunc("0 0 8 * * ?", func() { task.SetBrightnessAtDay() }) _ = c.AddFunc("0 0 18 * * ?", func() { task.SetBrightnessAtNight() }) c.Start() }