From 79466ec7430e1ad123c03d1ac852a50484398e2a Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Sun, 29 Jan 2023 14:36:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/const.go | 2 -- modules/pagoda/model_rank.go | 16 +++++------ modules/sociaty/api_cross_bossrank.go | 2 +- modules/timer/pagodarank.go | 41 ++++++++++++++------------- modules/timer/season.go | 9 ------ 5 files changed, 30 insertions(+), 40 deletions(-) diff --git a/comm/const.go b/comm/const.go index dc635beea..bc24d46b0 100644 --- a/comm/const.go +++ b/comm/const.go @@ -136,8 +136,6 @@ const ( ///有序的爬塔排行 (真正的排行榜 最多只有50条) TablePagodaRankList = "pagodaranklist" - TableSeasonRankList = "seasonranklist" // 赛季塔列表 - TableSeasonRecord = "seasonRecord" // 赛季塔记录 /// 美食馆 TableSmithy = "smithy" diff --git a/modules/pagoda/model_rank.go b/modules/pagoda/model_rank.go index 587629183..d05160f54 100644 --- a/modules/pagoda/model_rank.go +++ b/modules/pagoda/model_rank.go @@ -32,15 +32,15 @@ func (this *ModelRank) Init(service core.IService, module core.IModule, comp cor return } -func (this *ModelRank) GetRankData() (data []*pb.DBPagodaRecord, err error) { - data = make([]*pb.DBPagodaRecord, 0) - if conn, err := db.Cross(); err == nil { - err = conn.Redis.LRange(comm.TableSeasonRankList, 0, -1, &data) - } - //err = this.Redis.LRange(comm.TablePagodaRankList, 0, -1, &data) +// func (this *ModelRank) GetRankData() (data []*pb.DBPagodaRecord, err error) { +// data = make([]*pb.DBPagodaRecord, 0) +// if conn, err := db.Cross(); err == nil { +// err = conn.Redis.LRange(comm.TableSeasonRankList, 0, -1, &data) +// } +// //err = this.Redis.LRange(comm.TablePagodaRankList, 0, -1, &data) - return -} +// return +// } // 写记录 func (this *ModelRank) AddPagodaRecord(uid string, costTime, pagodaId, pagodaType int32) (err error) { diff --git a/modules/sociaty/api_cross_bossrank.go b/modules/sociaty/api_cross_bossrank.go index ee3c8b478..cb07bb8f8 100644 --- a/modules/sociaty/api_cross_bossrank.go +++ b/modules/sociaty/api_cross_bossrank.go @@ -11,7 +11,7 @@ import ( // 公会BOSS 赛季排行榜 func (this *apiComp) BrankCheck(session comm.IUserSession, req *pb.SociatyBRankReq) (code pb.ErrorCode) { - if req.RankType != 1 || req.RankType != 2 || req.RankType != 3 { + if req.RankType != 1 && req.RankType != 2 && req.RankType != 3 { code = pb.ErrorCode_ReqParameterError } return diff --git a/modules/timer/pagodarank.go b/modules/timer/pagodarank.go index 0728f0992..533e80d97 100644 --- a/modules/timer/pagodarank.go +++ b/modules/timer/pagodarank.go @@ -14,6 +14,7 @@ import ( "go.mongodb.org/mongo-driver/mongo/options" ) +// 此组件废弃 type PagodaRank struct { cbase.ModuleBase modules.MCompModel @@ -60,23 +61,23 @@ func (this *PagodaRank) TimerPagoda() { } } -func (this *PagodaRank) TimerSeason() { - data := make([]interface{}, 0) // options.Find().SetLimit(comm.MaxRankList) - if _data, err := this.DB.Find(comm.TableSeasonPagoda, bson.M{}, options.Find().SetSort(bson.M{"pagodaId": -1}).SetLimit(comm.MaxRankList)); err == nil { - for _data.Next(context.TODO()) { - temp := &pb.DBPagodaRecord{} - if err = _data.Decode(temp); err == nil { - data = append(data, temp) - } - } - } - if len(data) > 0 { - err := this.Redis.RPush(comm.TableSeasonRankList, data...) - if err == nil { - err = this.Redis.Ltrim(comm.TableSeasonRankList, -1*len(data), -1) //对一个列表进行修剪 - if err != nil { - log.Errorf("delete failed") - } - } - } -} +// func (this *PagodaRank) TimerSeason() { +// data := make([]interface{}, 0) // options.Find().SetLimit(comm.MaxRankList) +// if _data, err := this.DB.Find(comm.TableSeasonPagoda, bson.M{}, options.Find().SetSort(bson.M{"pagodaId": -1}).SetLimit(comm.MaxRankList)); err == nil { +// for _data.Next(context.TODO()) { +// temp := &pb.DBPagodaRecord{} +// if err = _data.Decode(temp); err == nil { +// data = append(data, temp) +// } +// } +// } +// if len(data) > 0 { +// err := this.Redis.RPush(comm.TableSeasonRankList, data...) +// if err == nil { +// err = this.Redis.Ltrim(comm.TableSeasonRankList, -1*len(data), -1) //对一个列表进行修剪 +// if err != nil { +// log.Errorf("delete failed") +// } +// } +// } +// } diff --git a/modules/timer/season.go b/modules/timer/season.go index d9e04ddd1..33e3238cb 100644 --- a/modules/timer/season.go +++ b/modules/timer/season.go @@ -231,7 +231,6 @@ func (this *SeasonPagoda) DbTest() { ) score = int64(i)<<31 + int64(math.MaxInt32-new.CostTime) tableName = "vikingRank" + strconv.Itoa(int(new.Bosstype)) - //vikingrank:mmmxxx1-63bbb137b96efbd321222ce7 strKey := "vikingrank:" + new.Uid + "-" + new.Id // 自定义key new.Uid // menbers = &redis.Z{Score: float64(score), Member: strKey} @@ -266,15 +265,7 @@ func (this *SeasonPagoda) DbTest() { if err := model1.Redis.HGetAll(v, result); err == nil { szRank = append(szRank, result) } - - // result := make([]*pb.DBVikingRank, 0) - // if err := model1.GetList(v, &result); err == nil { - // for _, v2 := range result { - // szRank = append(szRank, v2) - // } - // } } this.module.Debugf("%v", szRank) } - }