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 20:35:50 +08:00
|
|
|
func Init1() error {
|
|
|
|
|
|
|
|
for i := 0; i < 120; i++ {
|
|
|
|
day := time.Now().AddDate(0, 0, -1-i).Format("2006-01-02")
|
|
|
|
SyncCheckin(day)
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
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-09-04 22:25:04 +08:00
|
|
|
cron.Every(10).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
|
|
|
|
2023-09-05 10:49:24 +08:00
|
|
|
cron.Every(1).Day().At("01:00").Do(func() {
|
2023-08-31 22:20:40 +08:00
|
|
|
go SyncStaffInfo()
|
|
|
|
})
|
2023-09-04 22:25:04 +08:00
|
|
|
cron.Every(1).Month(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).At("02:00").Do(func() {
|
2023-09-04 19:14:02 +08:00
|
|
|
go SyncStaffSalary("")
|
|
|
|
})
|
2023-08-04 18:47:12 +08:00
|
|
|
cron.StartAsync()
|
2023-08-04 11:13:41 +08:00
|
|
|
return nil
|
|
|
|
}
|