gift_user.go 464 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
package user_cron

import (
	"git.hilo.cn/hilo-common/domain"
	"github.com/robfig/cron"
	"hilo-user/domain/model/recommend_m"
)

// 定期同步礼物推荐用户
func SyncGiftRecommendUsers() {
	go recommend_m.SyncPastTop50SendGiftUsers(domain.CreateModelNil()) // 启动先同步一次

	c := cron.New()
	spec := "0 */5 * * * ?"
	_ = c.AddFunc(spec, func() {
		var model = domain.CreateModelNil()
		recommend_m.SyncPastTop50SendGiftUsers(model)
	})
	c.Start()
}