package jobcron import ( "SCRM/service/sms_service" "SCRM/utils" "github.com/robfig/cron" ) // cron表达式 https://www.cnblogs.com/zuxingyu/p/6023919.html var smsCronJob *cron.Cron func init() { smsCronJob = cron.New() spec := "0 */5 * * * ?" // 每五分钟检查一次 smsCronJob.AddFunc(spec, func() { utils.TraceLog("定时发送未发送的短信") sms_service.SMSSendUnsendBatchRealTime() }) } func BeginSendUnsendSMSCronJob() { smsCronJob.Start() }