This commit is contained in:
jiangyong27 2023-10-23 18:07:03 +08:00
parent 78e45287f7
commit 41072277e0
2 changed files with 2 additions and 12 deletions

View File

@ -7,6 +7,7 @@ import (
"enterprise/common/weixin" "enterprise/common/weixin"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"strings" "strings"
"time"
) )
func SyncCheckin(day string) error { func SyncCheckin(day string) error {
@ -69,6 +70,7 @@ func SyncCheckin(day string) error {
if isUpdate { if isUpdate {
go NotifyCheckinOffDuty(checkin) go NotifyCheckinOffDuty(checkin)
} }
time.Sleep(60 * time.Second)
} }
return nil return nil

View File

@ -1,7 +1,6 @@
package worker package worker
import ( import (
"fmt"
"github.com/go-co-op/gocron" "github.com/go-co-op/gocron"
"time" "time"
) )
@ -21,17 +20,6 @@ func Init() error {
go SyncCheckin(time.Now().Format("2006-01-02")) 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"))
})
// 每天同步企业人事信息 // 每天同步企业人事信息
cron.Every(1).Day().At("01:00").Do(func() { cron.Every(1).Day().At("01:00").Do(func() {
go SyncStaffInfo() go SyncStaffInfo()