diff --git a/comm/imodule.go b/comm/imodule.go index 744db949a..c2da4755b 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -54,6 +54,8 @@ type ( GetSpecifiedHero(session IUserSession, heroConfId string, star, lv, amount int32) (code pb.ErrorCode) // 英雄加经验 AddHeroExp(session IUserSession, heroObjID string, exp int32) (code pb.ErrorCode) + // 英雄练功 + //KungFuHero(session IUserSession, heroObjID string) (code pb.ErrorCode) } //玩家 diff --git a/modules/pagoda/api_challenge.go b/modules/pagoda/api_challenge.go index fecf692fe..debe67f07 100644 --- a/modules/pagoda/api_challenge.go +++ b/modules/pagoda/api_challenge.go @@ -29,7 +29,6 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.PagodaChalleng code = pb.ErrorCode_PagodaNotFound return } - req.PagodaType = 101 cfg := this.module.configure.GetPagodaConfigData(req.PagodaType, req.LevelID) if cfg == nil { code = pb.ErrorCode_PagodaNotFound @@ -54,12 +53,13 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.PagodaChalleng rst.Uid = session.GetUserId() rst.Id = primitive.NewObjectID().Hex() rst.Type = req.PagodaType - rst.Nickname = "123" + rst.Nickname = this.module.ModuleUser.GetUser(session.GetUserId()).Name + rst.Lv = this.module.ModuleUser.GetUser(session.GetUserId()).Lv rst.PagodaId = pagoda.PagodaId this.module.modulerank.AddRank(session.GetUserId(), rst) } else { mapData := make(map[string]interface{}, 0) - mapData["pagodaId"] = pagoda.PagodaId + mapData["pagodaId"] = cfg.LayerNum mapData["type"] = pagoda.Type this.module.modulerank.ChangeUserRank(session.GetUserId(), mapData) diff --git a/modules/pagoda/api_getlist.go b/modules/pagoda/api_getlist.go index ff58f3f64..8f1ea808b 100644 --- a/modules/pagoda/api_getlist.go +++ b/modules/pagoda/api_getlist.go @@ -31,7 +31,7 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.PagodaGetListReq //_mData := make(map[string]interface{}, 0) result.Uid = session.GetUserId() result.PagodaId = 1 // 初始数据1层 - //_mData[result.Id] = result + result.Type = 101 this.module.modelPagoda.addNewPagoda(session.GetUserId(), result) session.SendMsg(string(this.module.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: result}) return diff --git a/modules/pagoda/api_ranklist.go b/modules/pagoda/api_ranklist.go index 6140b56ea..2510c5069 100644 --- a/modules/pagoda/api_ranklist.go +++ b/modules/pagoda/api_ranklist.go @@ -8,14 +8,14 @@ import ( ) //参数校验 -func (this *apiComp) RankLisCheck(session comm.IUserSession, req *pb.PagodaRankListReq) (code pb.ErrorCode) { +func (this *apiComp) RankListCheck(session comm.IUserSession, req *pb.PagodaRankListReq) (code pb.ErrorCode) { return } -func (this *apiComp) RankLis(session comm.IUserSession, req *pb.PagodaRankListReq) (code pb.ErrorCode, data proto.Message) { +func (this *apiComp) RankList(session comm.IUserSession, req *pb.PagodaRankListReq) (code pb.ErrorCode, data proto.Message) { - code = this.RankLisCheck(session, req) + code = this.RankListCheck(session, req) if code != pb.ErrorCode_Success { return // 参数校验失败直接返回 } diff --git a/modules/pagoda/model_rank.go b/modules/pagoda/model_rank.go index ea4537bde..2a05d4567 100644 --- a/modules/pagoda/model_rank.go +++ b/modules/pagoda/model_rank.go @@ -62,7 +62,7 @@ func (this *ModelRank) ChangeUserRank(uid string, value map[string]interface{}) // 临时测试 func (this *ModelRank) GetRankData(floorId int32, pagodaType int32) (data []*pb.DBPagodaRank, err error) { if floorId == 0 { - if _data, err := this.DB.Find(comm.TablePagodaRank, bson.M{"type": pagodaType}, options.Find().SetSort(bson.M{"pagodaId": 1})); err == nil { + if _data, err := this.DB.Find(comm.TablePagodaRank, bson.M{"type": pagodaType}, options.Find().SetSort(bson.M{"pagodaId": -1})); err == nil { for _data.Next(context.TODO()) { temp := &pb.DBPagodaRank{} if err = _data.Decode(temp); err == nil { @@ -71,7 +71,7 @@ func (this *ModelRank) GetRankData(floorId int32, pagodaType int32) (data []*pb. } } } else { - if _data, err := this.DB.Find(comm.TablePagodaRank, bson.M{"pagodaId": bson.M{"$gte": floorId}, "type": pagodaType}, options.Find().SetSort(bson.M{"pagodaId": 1})); err == nil { + if _data, err := this.DB.Find(comm.TablePagodaRank, bson.M{"pagodaId": bson.M{"$gte": floorId}, "type": pagodaType}, options.Find().SetSort(bson.M{"pagodaId": -1})); err == nil { for _data.Next(context.TODO()) { temp := &pb.DBPagodaRank{} if err = _data.Decode(temp); err == nil { diff --git a/pb/pagoda_db.pb.go b/pb/pagoda_db.pb.go index 703d2fa4c..34a0f0717 100644 --- a/pb/pagoda_db.pb.go +++ b/pb/pagoda_db.pb.go @@ -110,6 +110,8 @@ type DBPagodaRank struct { Type int32 `protobuf:"varint,4,opt,name=type,proto3" json:"type"` // 塔类型 Nickname string `protobuf:"bytes,5,opt,name=nickname,proto3" json:"nickname"` // 昵称 Icon string `protobuf:"bytes,6,opt,name=icon,proto3" json:"icon"` // 头像 + Lv int32 `protobuf:"varint,7,opt,name=lv,proto3" json:"lv"` // 等级 + CostTime int32 `protobuf:"varint,8,opt,name=costTime,proto3" json:"costTime" bson:"costTime"` //塔层 } func (x *DBPagodaRank) Reset() { @@ -186,6 +188,20 @@ func (x *DBPagodaRank) GetIcon() string { return "" } +func (x *DBPagodaRank) GetLv() int32 { + if x != nil { + return x.Lv + } + return 0 +} + +func (x *DBPagodaRank) GetCostTime() int32 { + if x != nil { + return x.CostTime + } + return 0 +} + var File_pagoda_pagoda_db_proto protoreflect.FileDescriptor var file_pagoda_pagoda_db_proto_rawDesc = []byte{ @@ -203,7 +219,7 @@ var file_pagoda_pagoda_db_proto_rawDesc = []byte{ 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, - 0x01, 0x22, 0x90, 0x01, 0x0a, 0x0c, 0x44, 0x42, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x52, 0x61, + 0x01, 0x22, 0xbc, 0x01, 0x0a, 0x0c, 0x44, 0x42, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x52, 0x61, 0x6e, 0x6b, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x49, 0x64, @@ -212,8 +228,10 @@ var file_pagoda_pagoda_db_proto_rawDesc = []byte{ 0x74, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x63, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x69, 0x63, 0x6f, 0x6e, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x63, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x02, 0x6c, 0x76, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x73, 0x74, 0x54, 0x69, 0x6d, 0x65, + 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, 0x6f, 0x73, 0x74, 0x54, 0x69, 0x6d, 0x65, + 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var (