check time
This commit is contained in:
parent
ff715ebbdf
commit
eebae54860
|
@ -1,6 +1,7 @@
|
||||||
package worker
|
package worker
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"github.com/go-co-op/gocron"
|
"github.com/go-co-op/gocron"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
@ -16,7 +17,18 @@ func Init1() error {
|
||||||
func Init() error {
|
func Init() error {
|
||||||
timezone, _ := time.LoadLocation("Asia/Shanghai")
|
timezone, _ := time.LoadLocation("Asia/Shanghai")
|
||||||
cron := gocron.NewScheduler(timezone)
|
cron := gocron.NewScheduler(timezone)
|
||||||
cron.Every(10).Minute().Do(func() {
|
cron.Every(1).Hour().Do(func() {
|
||||||
|
go SyncCheckin(time.Now().Format("2006-01-02"))
|
||||||
|
})
|
||||||
|
|
||||||
|
// 早晚高频拉取
|
||||||
|
sch := cron.Every(1).Day()
|
||||||
|
for i := 0; i < 12; i++ {
|
||||||
|
sch.At(fmt.Sprintf("08:%02d", i*5))
|
||||||
|
sch.At(fmt.Sprintf("09:%02d", i*5))
|
||||||
|
sch.At(fmt.Sprintf("18:%02d", i*5))
|
||||||
|
}
|
||||||
|
sch.Do(func() {
|
||||||
go SyncCheckin(time.Now().Format("2006-01-02"))
|
go SyncCheckin(time.Now().Format("2006-01-02"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue