package task import ( "eta/eta_mini_ht_api/task/base" _ "eta/eta_mini_ht_api/task/eta/author" _ "eta/eta_mini_ht_api/task/message" _ "eta/eta_mini_ht_api/task/report" _ "eta/eta_mini_ht_api/task/sms" "github.com/beego/beego/v2/server/web" "github.com/beego/beego/v2/task" ) func AddTasksToScheduler() { for _, t := range base.GetTasks() { if t.RunMode == web.BConfig.RunMode { tk := task.NewTask(string(t.Name), t.Cron, t.Run) task.AddTask(string(t.Name), tk) } } } // StartScheduler 启动任务调度器 func StartScheduler() { task.StartTask() } func init() { AddTasksToScheduler() StartScheduler() }