赛季通行证排行榜

This commit is contained in:
sk 2024-07-03 15:25:33 +08:00
parent 0c45f9c44a
commit e2d18f491b
4 changed files with 5 additions and 3 deletions

View File

@ -22,7 +22,7 @@ func RankPlayerPermitCollection(plt string) *mongo.Collection {
c, first := s.DB().C(RankPlayerPermitCollName) c, first := s.DB().C(RankPlayerPermitCollName)
if first { if first {
c.EnsureIndex(mgo.Index{Key: []string{"snid"}, Background: true, Sparse: true}) c.EnsureIndex(mgo.Index{Key: []string{"snid"}, Background: true, Sparse: true})
c.EnsureIndex(mgo.Index{Key: []string{"startts", "-exp"}, Background: true, Sparse: true}) c.EnsureIndex(mgo.Index{Key: []string{"startts", "-exp", "-ts"}, Background: true, Sparse: true})
} }
return c return c
} }
@ -60,7 +60,7 @@ func (svc *RankPlayerPermitSvc) Find(args *model.FindPlayerPermitListArgs, ret *
return RankPlayerPermitColError return RankPlayerPermitColError
} }
err := fc.Find(bson.M{"startts": args.StartTs}).Sort("-exp").Limit(int(model.GameParamData.RankPlayerPermitMaxNum)).All(&ret.List) err := fc.Find(bson.M{"startts": args.StartTs}).Sort("-exp", "-ts").Limit(int(model.GameParamData.RankPlayerPermitMaxNum)).All(&ret.List)
if err != nil && !errors.Is(err, mgo.ErrNotFound) { if err != nil && !errors.Is(err, mgo.ErrNotFound) {
logger.Logger.Error("QueryPermit is err: ", err) logger.Logger.Error("QueryPermit is err: ", err)
return err return err

View File

@ -207,6 +207,6 @@ func InitGameParam() {
GameParamData.BackendTimeLocal = 8 GameParamData.BackendTimeLocal = 8
} }
if GameParamData.RankPlayerPermitMaxNum == 0 { if GameParamData.RankPlayerPermitMaxNum == 0 {
GameParamData.RankPlayerPermitMaxNum = 100 GameParamData.RankPlayerPermitMaxNum = 20
} }
} }

View File

@ -285,6 +285,7 @@ type PermitScore struct {
Exp int64 Exp int64
ModId int32 //头像 ModId int32 //头像
StartTs int64 // 赛季开始时间戳 StartTs int64 // 赛季开始时间戳
Ts int64
} }
type FindPlayerPermitListArgs struct { type FindPlayerPermitListArgs struct {

View File

@ -312,6 +312,7 @@ func (this *BagMgr) AddItems(p *Player, addItems []*Item, add int64, gainWay int
Exp: item.ItemNum, Exp: item.ItemNum,
ModId: p.Roles.ModId, ModId: p.Roles.ModId,
StartTs: startTs, StartTs: startTs,
Ts: time.Now().Unix(),
}) })
// 参与赛季通行证活动 // 参与赛季通行证活动
if longItem == nil || longItem.ItemNum == 0 { if longItem == nil || longItem.ItemNum == 0 {