enterprise/worker/worker.go

18 lines
300 B
Go
Raw Normal View History

2023-08-04 11:13:41 +08:00
package worker
2023-08-04 18:27:37 +08:00
import (
"github.com/go-co-op/gocron"
"time"
)
2023-08-04 11:13:41 +08:00
func Init() error {
2023-08-04 18:27:37 +08:00
timezone, _ := time.LoadLocation("Asia/Shanghai")
cron := gocron.NewScheduler(timezone)
2023-08-04 18:47:12 +08:00
cron.Every(5).Minute().Do(func() {
2023-08-04 18:27:37 +08:00
go SyncCheckin(time.Now().Format("2006-01-02"))
})
2023-08-04 18:47:12 +08:00
cron.StartAsync()
2023-08-04 11:13:41 +08:00
return nil
}