enterprise/worker/worker.go

18 lines
300 B
Go

package worker
import (
"github.com/go-co-op/gocron"
"time"
)
func Init() error {
timezone, _ := time.LoadLocation("Asia/Shanghai")
cron := gocron.NewScheduler(timezone)
cron.Every(5).Minute().Do(func() {
go SyncCheckin(time.Now().Format("2006-01-02"))
})
cron.StartAsync()
return nil
}