竞技馆奖励记录最新50条

This commit is contained in:
sk 2024-09-29 11:21:04 +08:00
parent e8c4f4489f
commit e07963720d
3 changed files with 7 additions and 1 deletions

View File

@ -39,7 +39,7 @@ func (this *DBCustomLogAwardSvc) Find(req *model.CustomLogAwardFindReq, res *mod
return ErrCustomLogAwardNotFound
}
if err := c.Find(bson.M{"startts": bson.M{"$gte": req.StartTs, "$lte": req.EndTs}}).Sort("startts").All(&res.List); err != nil {
if err := c.Find(bson.M{"startts": bson.M{"$gte": req.StartTs, "$lte": req.EndTs}}).Sort("-startts").Limit(50).All(&res.List); err != nil {
return err
}
return nil

View File

@ -92,6 +92,7 @@ func (r *ListMgr[T]) Take(platform string, index int32, f func([]T, error)) {
}
// UpdateCache 更新缓存
// 重新获取数据
func (r *ListMgr[T]) UpdateCache(platform string, index int32) {
tp := r.platform[platform]
if tp == nil {

View File

@ -7,6 +7,7 @@ import (
"github.com/jinzhu/now"
"mongo.games.com/goserver/core/logger"
"mongo.games.com/goserver/core/module"
"mongo.games.com/goserver/core/timer"
"mongo.games.com/goserver/srvlib"
"mongo.games.com/goserver/srvlib/action"
@ -84,6 +85,10 @@ func (c *CustomAwardMgr) Update() {
StartTs: nowTime.Add(-time.Minute * 8).Unix(),
EndTs: nowTime.Unix(),
})
timer.AfterTimer(func(h timer.TimerHandle, ud interface{}) bool {
CustomAwardMgrInstance.UpdateCache(k, 0)
return true
}, nil, time.Second*2)
// 通知获奖
pack := &rank.UserAward{
Snid: int32(id),