package crontab import ( "github.com/robfig/cron/v3" ) type TaskExecutor struct { c *cron.Cron } // NewTaskExecutor 初始化 func NewTaskExecutor() *TaskExecutor { return &TaskExecutor{ c: cron.New(cron.WithSeconds()), } } // Start 启动 func (t *TaskExecutor) Start() { t.c.Start() } // Stop 停止 func (t *TaskExecutor) Stop() { t.c.Stop() }