diff --git a/dbproxy/svc/l_customaward.go b/dbproxy/svc/l_customaward.go index 77c1f2d..76daa52 100644 --- a/dbproxy/svc/l_customaward.go +++ b/dbproxy/svc/l_customaward.go @@ -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 diff --git a/ranksrv/com/listmgr.go b/ranksrv/com/listmgr.go index 14d818e..218cfe3 100644 --- a/ranksrv/com/listmgr.go +++ b/ranksrv/com/listmgr.go @@ -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 { diff --git a/ranksrv/rank/customaward.go b/ranksrv/rank/customaward.go index fdafc74..b2f9aed 100644 --- a/ranksrv/rank/customaward.go +++ b/ranksrv/rank/customaward.go @@ -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),