Merge branch 'meixiongfeng' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev

This commit is contained in:
meixiongfeng 2023-01-29 14:37:00 +08:00
commit 04e7d02e10
5 changed files with 30 additions and 40 deletions

View File

@ -136,8 +136,6 @@ const (
///有序的爬塔排行 (真正的排行榜 最多只有50条) ///有序的爬塔排行 (真正的排行榜 最多只有50条)
TablePagodaRankList = "pagodaranklist" TablePagodaRankList = "pagodaranklist"
TableSeasonRankList = "seasonranklist" // 赛季塔列表
TableSeasonRecord = "seasonRecord" // 赛季塔记录 TableSeasonRecord = "seasonRecord" // 赛季塔记录
/// 美食馆 /// 美食馆
TableSmithy = "smithy" TableSmithy = "smithy"

View File

@ -32,15 +32,15 @@ func (this *ModelRank) Init(service core.IService, module core.IModule, comp cor
return return
} }
func (this *ModelRank) GetRankData() (data []*pb.DBPagodaRecord, err error) { // func (this *ModelRank) GetRankData() (data []*pb.DBPagodaRecord, err error) {
data = make([]*pb.DBPagodaRecord, 0) // data = make([]*pb.DBPagodaRecord, 0)
if conn, err := db.Cross(); err == nil { // if conn, err := db.Cross(); err == nil {
err = conn.Redis.LRange(comm.TableSeasonRankList, 0, -1, &data) // err = conn.Redis.LRange(comm.TableSeasonRankList, 0, -1, &data)
} // }
//err = this.Redis.LRange(comm.TablePagodaRankList, 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) { func (this *ModelRank) AddPagodaRecord(uid string, costTime, pagodaId, pagodaType int32) (err error) {

View File

@ -11,7 +11,7 @@ import (
// 公会BOSS 赛季排行榜 // 公会BOSS 赛季排行榜
func (this *apiComp) BrankCheck(session comm.IUserSession, req *pb.SociatyBRankReq) (code pb.ErrorCode) { 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 code = pb.ErrorCode_ReqParameterError
} }
return return

View File

@ -14,6 +14,7 @@ import (
"go.mongodb.org/mongo-driver/mongo/options" "go.mongodb.org/mongo-driver/mongo/options"
) )
// 此组件废弃
type PagodaRank struct { type PagodaRank struct {
cbase.ModuleBase cbase.ModuleBase
modules.MCompModel modules.MCompModel
@ -60,23 +61,23 @@ func (this *PagodaRank) TimerPagoda() {
} }
} }
func (this *PagodaRank) TimerSeason() { // func (this *PagodaRank) TimerSeason() {
data := make([]interface{}, 0) // options.Find().SetLimit(comm.MaxRankList) // 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 { // 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()) { // for _data.Next(context.TODO()) {
temp := &pb.DBPagodaRecord{} // temp := &pb.DBPagodaRecord{}
if err = _data.Decode(temp); err == nil { // if err = _data.Decode(temp); err == nil {
data = append(data, temp) // data = append(data, temp)
} // }
} // }
} // }
if len(data) > 0 { // if len(data) > 0 {
err := this.Redis.RPush(comm.TableSeasonRankList, data...) // err := this.Redis.RPush(comm.TableSeasonRankList, data...)
if err == nil { // if err == nil {
err = this.Redis.Ltrim(comm.TableSeasonRankList, -1*len(data), -1) //对一个列表进行修剪 // err = this.Redis.Ltrim(comm.TableSeasonRankList, -1*len(data), -1) //对一个列表进行修剪
if err != nil { // if err != nil {
log.Errorf("delete failed") // log.Errorf("delete failed")
} // }
} // }
} // }
} // }

View File

@ -231,7 +231,6 @@ func (this *SeasonPagoda) DbTest() {
) )
score = int64(i)<<31 + int64(math.MaxInt32-new.CostTime) score = int64(i)<<31 + int64(math.MaxInt32-new.CostTime)
tableName = "vikingRank" + strconv.Itoa(int(new.Bosstype)) tableName = "vikingRank" + strconv.Itoa(int(new.Bosstype))
//vikingrank:mmmxxx1-63bbb137b96efbd321222ce7
strKey := "vikingrank:" + new.Uid + "-" + new.Id // 自定义key new.Uid // strKey := "vikingrank:" + new.Uid + "-" + new.Id // 自定义key new.Uid //
menbers = &redis.Z{Score: float64(score), Member: strKey} 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 { if err := model1.Redis.HGetAll(v, result); err == nil {
szRank = append(szRank, result) 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) this.module.Debugf("%v", szRank)
} }
} }