排行榜

This commit is contained in:
meixiongfeng 2022-08-24 16:48:49 +08:00
parent b912028e61
commit 8d6a271d6c
15 changed files with 737 additions and 417 deletions

File diff suppressed because it is too large Load Diff

View File

@ -109,6 +109,8 @@ const (
TablePagodaRank = "pagodarank"
/// 美食馆
TableSmithy = "smithy"
/// 赛季塔数据表
TableSeasonPagoda = "seasonpagoda"
)
//RPC服务接口定义处
@ -218,3 +220,11 @@ const (
ResonanceAtkPro = "atkpro"
ResonanceDefPro = "defpro"
)
const (
PagodaType = 101 // 普通塔
)
const (
MaxRankList = 50
)

View File

@ -103,6 +103,7 @@ func (this *Redis) LRange(key string, start, end int, v interface{}) (err error)
}
return
}
/*
Redis Lrange 返回列表中指定区间内的元素区间以偏移量 START END 指定 其中 0 表示列表的第一个元素 1 表示列表的第二个元素
以此类推 你也可以使用负数下标 -1 表示列表的最后一个元素 -2 表示列表的倒数第二个元素以此类推
@ -185,7 +186,7 @@ Redis Rpush 命令用于将一个或多个值插入到列表的尾部(最右边)
*/
func (this *Redis) RPush(key string, values ...interface{}) (err error) {
agrs := make([]interface{}, 0)
agrs = append(agrs, "RPUSH")
agrs = append(agrs, "RPUSH", key)
for _, v := range values {
result, _ := this.codec.Marshal(v)
agrs = append(agrs, result)

View File

@ -10,7 +10,7 @@ import (
//参数校验
func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.PagodaChallengeReq) (code pb.ErrorCode) {
if req.LevelID <= 0 {
if req.LevelID <= 0 && req.PagodaType != 0 {
code = pb.ErrorCode_ReqParameterError
return
}
@ -19,11 +19,15 @@ func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.PagodaCha
///挑战主线关卡
func (this *apiComp) Challenge(session comm.IUserSession, req *pb.PagodaChallengeReq) (code pb.ErrorCode, data proto.Message) {
var (
mapData map[string]interface{}
)
mapData = make(map[string]interface{}, 0)
code = this.ChallengeCheck(session, req)
if code != pb.ErrorCode_Success {
return // 参数校验失败直接返回
}
pagoda, err := this.module.modelPagoda.getPagodaList(session.GetUserId())
if err != nil {
code = pb.ErrorCode_PagodaNotFound
@ -34,45 +38,81 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.PagodaChalleng
code = pb.ErrorCode_PagodaNotFound
return
}
if pagoda.Type == cfg.PagodaType && cfg.LayerNum != pagoda.PagodaId {
code = pb.ErrorCode_PagodaLevlErr // 挑战关卡数据不匹配
return
}
if req.PagodaType == comm.PagodaType { // 普通塔
//// todo 战斗相关
mapData := make(map[string]interface{}, 0)
if pagoda.Type != cfg.PagodaType {
pagoda.Type = cfg.PagodaType
mapData["type"] = pagoda.Type
}
pagoda.Type = req.PagodaType
if pagoda.Type != cfg.PagodaType || cfg.PreLevel != pagoda.PagodaId {
code = pb.ErrorCode_PagodaLevlErr // 挑战关卡数据不匹配
return
}
/////
rst, _ := this.module.modulerank.GetUserRandData(session.GetUserId())
if rst.Uid == "" {
rst.Uid = session.GetUserId()
rst.Id = primitive.NewObjectID().Hex()
rst.Type = req.PagodaType
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)
//// todo 战斗相关
pagoda.Type = req.PagodaType
mapData["pagodaId"] = cfg.LayerNum
mapData["type"] = pagoda.Type
this.module.modulerank.ChangeUserRank(session.GetUserId(), mapData)
}
/////
// 通关奖励
code = this.module.DispenseRes(session, cfg.Reward, true)
if code != pb.ErrorCode_Success {
// 通关奖励
code = this.module.DispenseRes(session, cfg.Reward, true)
if code != pb.ErrorCode_Success {
return
}
pagoda.PagodaId = cfg.LayerNum // 更新层数
mapData["pagodaId"] = cfg.LayerNum
code = this.module.ModifyPagodaData(session.GetUserId(), mapData)
session.SendMsg(string(this.module.GetType()), PagodaChallengeResp, &pb.PagodaChallengeResp{Data: pagoda})
return
} else {
// 普通塔通关了
Nomalcfg := this.module.configure.GetPagodaConfigData(comm.PagodaType, pagoda.PagodaId+1)
if Nomalcfg != nil {
code = pb.ErrorCode_PagodaNotFound
return
}
seasonPagoda, _ := this.module.modelSeasonPagoda.getSeasonPagodaList(session.GetUserId())
if seasonPagoda == nil {
if req.LevelID != 1 {
code = pb.ErrorCode_PagodaLevlErr // 挑战关卡数据不匹配
return
}
} else {
if seasonPagoda.Type != req.PagodaType || cfg.PreLevel != seasonPagoda.PagodaId {
code = pb.ErrorCode_PagodaLevlErr // 挑战关卡数据不匹配
return
}
}
// 挑战处理
if seasonPagoda == nil {
seasonPagoda = &pb.DBSeasonPagoda{}
seasonPagoda.Id = primitive.NewObjectID().Hex()
seasonPagoda.Uid = session.GetUserId()
seasonPagoda.PagodaId = 1 // 初始数据1层
seasonPagoda.Type = req.PagodaType
this.module.modelSeasonPagoda.addNewSeasonPagoda(session.GetUserId(), seasonPagoda)
} else {
pagoda.PagodaId = cfg.LayerNum
mapData["pagodaId"] = cfg.LayerNum
code = this.module.ModifySeasonPagodaData(session.GetUserId(), mapData)
}
rst, _ := this.module.modulerank.GetUserRandData(session.GetUserId())
if rst.Uid == "" {
rst.Uid = session.GetUserId()
rst.Id = primitive.NewObjectID().Hex()
rst.Type = req.PagodaType
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["pagodaId"] = cfg.LayerNum
this.module.modulerank.ChangeUserRank(session.GetUserId(), mapData)
}
}
pagoda.PagodaId = cfg.NextLevel // 更新层数
mapData["pagodaId"] = cfg.NextLevel
code = this.module.ModifyPagodaData(session.GetUserId(), mapData)
session.SendMsg(string(this.module.GetType()), PagodaChallengeResp, &pb.PagodaChallengeResp{Data: pagoda})
return
}

View File

@ -3,6 +3,7 @@ package pagoda
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"log"
"go.mongodb.org/mongo-driver/bson/primitive"
"google.golang.org/protobuf/proto"
@ -16,27 +17,35 @@ func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.PagodaGetLi
///获取主线关卡信息
func (this *apiComp) GetList(session comm.IUserSession, req *pb.PagodaGetListReq) (code pb.ErrorCode, data proto.Message) {
var (
list *pb.DBPagoda
)
code = this.GetListCheck(session, req)
if code != pb.ErrorCode_Success {
return // 参数校验失败直接返回
}
list, _ := this.module.modelPagoda.getPagodaList(session.GetUserId())
list, _ = this.module.modelPagoda.getPagodaList(session.GetUserId())
defer func() {
session.SendMsg(string(this.module.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: list})
}()
if list == nil { // redis没有数据
result := &pb.DBPagoda{}
result.Id = primitive.NewObjectID().Hex()
list = &pb.DBPagoda{}
list.Id = primitive.NewObjectID().Hex()
//_mData := make(map[string]interface{}, 0)
result.Uid = session.GetUserId()
result.PagodaId = 1 // 初始数据1层
result.Type = 101
this.module.modelPagoda.addNewPagoda(session.GetUserId(), result)
session.SendMsg(string(this.module.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: result})
list.Uid = session.GetUserId()
list.PagodaId = 0 // 初始数据1层
list.Type = comm.PagodaType
this.module.modelPagoda.addNewPagoda(session.GetUserId(), list)
return
}
session.SendMsg(string(this.module.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: list})
season, _ := this.module.modelSeasonPagoda.getSeasonPagodaList(session.GetUserId())
if season != nil {
list.PagodaId = season.PagodaId
list.Type = season.Type
}
ranklist, _ := this.module.modulerank.GetRankData()
log.Fatalf("%v", ranklist)
return
}

View File

@ -20,7 +20,7 @@ func (this *apiComp) RankList(session comm.IUserSession, req *pb.PagodaRankListR
return // 参数校验失败直接返回
}
// 临时测试用
szRank, err := this.module.modulerank.GetRankData(req.FloorId, req.Type)
szRank, err := this.module.modulerank.GetRankData()
if err != nil {
code = pb.ErrorCode_DBError
}

View File

@ -1,15 +1,11 @@
package pagoda
import (
"context"
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/redis"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo/options"
)
type ModelRank struct {
@ -60,26 +56,8 @@ 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 {
for _data.Next(context.TODO()) {
temp := &pb.DBPagodaRank{}
if err = _data.Decode(temp); err == nil {
data = append(data, temp)
}
}
}
} 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 {
for _data.Next(context.TODO()) {
temp := &pb.DBPagodaRank{}
if err = _data.Decode(temp); err == nil {
data = append(data, temp)
}
}
}
}
func (this *ModelRank) GetRankData() (data []*pb.DBPagodaRank, err error) {
err = this.Redis.Get(comm.TablePagodaRank, data)
return
}

View File

@ -0,0 +1,62 @@
package pagoda
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/redis"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/x/bsonx"
)
/// 赛季塔
type ModelSeasonPagoda struct {
modules.MCompModel
module *Pagoda
}
func (this *ModelSeasonPagoda) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.TableName = string(comm.TableSeasonPagoda)
err = this.MCompModel.Init(service, module, comp, options)
this.module = module.(*Pagoda)
//创建uid索引
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
})
return
}
// 获取爬塔信息
func (this *ModelSeasonPagoda) getSeasonPagodaList(uid string) (result *pb.DBSeasonPagoda, err error) {
result = &pb.DBSeasonPagoda{}
if err = this.Get(uid, result); err != nil {
if redis.RedisNil != err {
result = nil
}
return
}
err = nil
return result, err
}
// 修改爬塔数据信息
func (this *ModelSeasonPagoda) modifySeasonPagodaDataByObjId(uid string, data map[string]interface{}) error {
return this.Change(uid, data)
}
// 创建一个新的塔数据
func (this *ModelSeasonPagoda) addNewSeasonPagoda(uId string, data *pb.DBSeasonPagoda) (err error) {
if err = this.Add(uId, data); err != nil {
this.module.Errorf("err:%v", err)
return
}
return nil
}
// 赛季结束 清理所有塔数据
func (this *ModelSeasonPagoda) DleAllSeasonData() {
return
}

View File

@ -9,10 +9,11 @@ import (
type Pagoda struct {
modules.ModuleBase
modelPagoda *ModelPagoda
api *apiComp
modulerank *ModelRank
configure *configureComp
modelPagoda *ModelPagoda
modelSeasonPagoda *ModelSeasonPagoda
api *apiComp
modulerank *ModelRank
configure *configureComp
}
func NewModule() core.IModule {
@ -33,6 +34,7 @@ func (this *Pagoda) OnInstallComp() {
this.ModuleBase.OnInstallComp()
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
this.modelPagoda = this.RegisterComp(new(ModelPagoda)).(*ModelPagoda)
this.modelSeasonPagoda = this.RegisterComp(new(ModelSeasonPagoda)).(*ModelSeasonPagoda)
this.modulerank = this.RegisterComp(new(ModelRank)).(*ModelRank)
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
}
@ -45,3 +47,12 @@ func (this *Pagoda) ModifyPagodaData(uid string, data map[string]interface{}) (c
}
return
}
// 修改赛季塔信息
func (this *Pagoda) ModifySeasonPagodaData(uid string, data map[string]interface{}) (code pb.ErrorCode) {
err := this.modelSeasonPagoda.modifySeasonPagodaDataByObjId(uid, data)
if err != nil {
code = pb.ErrorCode_DBError
}
return
}

View File

@ -1,33 +1,31 @@
package timer
import (
"go_dreamfactory/comm"
"go_dreamfactory/modules"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/cron"
)
/*
装备模块 API
*/
type forumComp struct {
modules.MCompGate
modules.MCompModel
service core.IService
}
//组件初始化接口
func (this *forumComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.MCompGate.Init(service, module, comp, options)
this.TableName = comm.TablePagodaRank
this.MCompModel.Init(service, module, comp, options)
this.service = service
return
}
func (this *forumComp) Start() (err error) {
err = this.MCompGate.Start()
cron.AddFunc("*/5 * * * * ?", this.Timer) //每五秒执行一次
func (this *forumComp) Start(timeSec int32) (err error) {
err = this.MCompModel.Start()
//cron.AddFunc("*/5 * * * * ?", this.Timer) //每五秒执行一次
return
}
func (this *forumComp) Timer() {
}

View File

@ -5,6 +5,7 @@ import (
"go_dreamfactory/lego/base"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/core/cbase"
"go_dreamfactory/modules"
)
/*
@ -14,12 +15,15 @@ import (
*/
func NewModule() core.IModule {
m := new(Timer)
return m
}
type Timer struct {
cbase.ModuleBase
modules.MCompModel
service base.IRPCXService //rpc服务对象 通过这个对象可以发布服务和调用其他服务的接口
rank *PagodaRank
}
//模块名
@ -27,6 +31,11 @@ func (this *Timer) GetType() core.M_Modules {
return comm.ModuleTimer
}
// NewOptions 模块自定义参数
func (this *Timer) NewOptions() (options core.IModuleOptions) {
return new(Options)
}
//模块初始化接口 注册用户创建角色事件
func (this *Timer) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
err = this.ModuleBase.Init(service, module, options)
@ -36,10 +45,12 @@ func (this *Timer) Init(service core.IService, module core.IModule, options core
func (this *Timer) Start() (err error) {
err = this.ModuleBase.Start()
return
}
//装备组件
func (this *Timer) OnInstallComp() {
this.ModuleBase.OnInstallComp()
this.rank = this.RegisterComp(new(PagodaRank)).(*PagodaRank)
}

23
modules/timer/options.go Normal file
View File

@ -0,0 +1,23 @@
package timer
import (
"go_dreamfactory/lego/utils/mapstructure"
"go_dreamfactory/modules"
)
type (
Options struct {
modules.Options
}
)
// LoadConfig 配置文件序列化为Options
func (this *Options) LoadConfig(settings map[string]interface{}) (err error) {
if settings != nil {
if err = this.Options.LoadConfig(settings); err != nil {
return
}
err = mapstructure.Decode(settings, this)
}
return
}

View File

@ -0,0 +1,67 @@
package timer
import (
"context"
"go_dreamfactory/comm"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/cron"
"go_dreamfactory/lego/sys/log"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo/options"
)
type PagodaRank struct {
modules.MCompModel
service core.IService
}
//组件初始化接口
func (this *PagodaRank) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.TableName = comm.TablePagodaRank
this.MCompModel.Init(service, module, comp, options)
this.service = service
return
}
func (this *PagodaRank) Start() (err error) {
err = this.MCompModel.Start()
cron.AddFunc("*/5 * * * * ?", this.Timer) //每五秒执行一次
return
}
// 处理排行榜排序
func (this *PagodaRank) Timer() {
data := make([]interface{}, 0) // options.Find().SetLimit(comm.MaxRankList)
if _data, err := this.DB.Find(comm.TablePagodaRank, bson.M{}, options.Find().SetSort(bson.M{"pagodaId": -1}).SetLimit(comm.MaxRankList)); err == nil {
for _data.Next(context.TODO()) {
temp := &pb.DBPagodaRank{}
if err = _data.Decode(temp); err == nil {
data = append(data, temp)
}
}
}
if len(data) > 0 {
// keys, err := this.Redis.Keys(comm.TablePagodaRank) // 这种方式效率太低不建议使用
// if err != nil {
// for _, v := range keys {
// err = this.Redis.Delete(v)
// if err != nil {
// log.Errorf("delete failed")
// }
// }
// }
// iLne, _ := this.Redis.Llen(comm.TablePagodaRank)
err := this.Redis.RPush(comm.TablePagodaRank, data...)
if err == nil {
err = this.Redis.Ltrim(comm.TablePagodaRank, -1*len(data), -1) //对一个列表进行修剪
if err != nil {
log.Errorf("delete failed")
}
}
}
}

View File

@ -20,6 +20,7 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
//普通塔
type DBPagoda struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -99,6 +100,86 @@ func (x *DBPagoda) GetType() int32 {
return 0
}
// 赛季塔 赛季结束会清理
type DBSeasonPagoda struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
PagodaId int32 `protobuf:"varint,3,opt,name=pagodaId,proto3" json:"pagodaId" bson:"pagodaId"` //塔层
Reward map[int32]bool `protobuf:"bytes,4,rep,name=reward,proto3" json:"reward" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 是否领奖
Type int32 `protobuf:"varint,5,opt,name=type,proto3" json:"type"`
}
func (x *DBSeasonPagoda) Reset() {
*x = DBSeasonPagoda{}
if protoimpl.UnsafeEnabled {
mi := &file_pagoda_pagoda_db_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DBSeasonPagoda) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DBSeasonPagoda) ProtoMessage() {}
func (x *DBSeasonPagoda) ProtoReflect() protoreflect.Message {
mi := &file_pagoda_pagoda_db_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DBSeasonPagoda.ProtoReflect.Descriptor instead.
func (*DBSeasonPagoda) Descriptor() ([]byte, []int) {
return file_pagoda_pagoda_db_proto_rawDescGZIP(), []int{1}
}
func (x *DBSeasonPagoda) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *DBSeasonPagoda) GetUid() string {
if x != nil {
return x.Uid
}
return ""
}
func (x *DBSeasonPagoda) GetPagodaId() int32 {
if x != nil {
return x.PagodaId
}
return 0
}
func (x *DBSeasonPagoda) GetReward() map[int32]bool {
if x != nil {
return x.Reward
}
return nil
}
func (x *DBSeasonPagoda) GetType() int32 {
if x != nil {
return x.Type
}
return 0
}
type DBPagodaRank struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -111,13 +192,13 @@ type DBPagodaRank struct {
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"` //塔层
CostTime int32 `protobuf:"varint,8,opt,name=costTime,proto3" json:"costTime" bson:"costTime"` //每层塔耗时 单位s
}
func (x *DBPagodaRank) Reset() {
*x = DBPagodaRank{}
if protoimpl.UnsafeEnabled {
mi := &file_pagoda_pagoda_db_proto_msgTypes[1]
mi := &file_pagoda_pagoda_db_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -130,7 +211,7 @@ func (x *DBPagodaRank) String() string {
func (*DBPagodaRank) ProtoMessage() {}
func (x *DBPagodaRank) ProtoReflect() protoreflect.Message {
mi := &file_pagoda_pagoda_db_proto_msgTypes[1]
mi := &file_pagoda_pagoda_db_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -143,7 +224,7 @@ func (x *DBPagodaRank) ProtoReflect() protoreflect.Message {
// Deprecated: Use DBPagodaRank.ProtoReflect.Descriptor instead.
func (*DBPagodaRank) Descriptor() ([]byte, []int) {
return file_pagoda_pagoda_db_proto_rawDescGZIP(), []int{1}
return file_pagoda_pagoda_db_proto_rawDescGZIP(), []int{2}
}
func (x *DBPagodaRank) GetId() string {
@ -219,19 +300,33 @@ 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, 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,
0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x49, 0x64,
0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04,
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, 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,
0x01, 0x22, 0xd2, 0x01, 0x0a, 0x0e, 0x44, 0x42, 0x53, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x50, 0x61,
0x67, 0x6f, 0x64, 0x61, 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, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x6f, 0x64, 0x61,
0x49, 0x64, 0x12, 0x33, 0x0a, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x04, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x44, 0x42, 0x53, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x50, 0x61, 0x67,
0x6f, 0x64, 0x61, 0x2e, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52,
0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18,
0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x1a, 0x39, 0x0a, 0x0b, 0x52,
0x65, 0x77, 0x61, 0x72, 0x64, 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, 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, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67,
0x6f, 0x64, 0x61, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20,
0x01, 0x28, 0x05, 0x52, 0x04, 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, 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 (
@ -246,19 +341,22 @@ func file_pagoda_pagoda_db_proto_rawDescGZIP() []byte {
return file_pagoda_pagoda_db_proto_rawDescData
}
var file_pagoda_pagoda_db_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_pagoda_pagoda_db_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_pagoda_pagoda_db_proto_goTypes = []interface{}{
(*DBPagoda)(nil), // 0: DBPagoda
(*DBPagodaRank)(nil), // 1: DBPagodaRank
nil, // 2: DBPagoda.RewardEntry
(*DBPagoda)(nil), // 0: DBPagoda
(*DBSeasonPagoda)(nil), // 1: DBSeasonPagoda
(*DBPagodaRank)(nil), // 2: DBPagodaRank
nil, // 3: DBPagoda.RewardEntry
nil, // 4: DBSeasonPagoda.RewardEntry
}
var file_pagoda_pagoda_db_proto_depIdxs = []int32{
2, // 0: DBPagoda.reward:type_name -> DBPagoda.RewardEntry
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
3, // 0: DBPagoda.reward:type_name -> DBPagoda.RewardEntry
4, // 1: DBSeasonPagoda.reward:type_name -> DBSeasonPagoda.RewardEntry
2, // [2:2] is the sub-list for method output_type
2, // [2:2] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_pagoda_pagoda_db_proto_init() }
@ -280,6 +378,18 @@ func file_pagoda_pagoda_db_proto_init() {
}
}
file_pagoda_pagoda_db_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DBSeasonPagoda); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_pagoda_pagoda_db_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DBPagodaRank); i {
case 0:
return &v.state
@ -298,7 +408,7 @@ func file_pagoda_pagoda_db_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_pagoda_pagoda_db_proto_rawDesc,
NumEnums: 0,
NumMessages: 3,
NumMessages: 5,
NumExtensions: 0,
NumServices: 0,
},

View File

@ -14,7 +14,7 @@ type GamePagodaData struct {
Key int32
PagodaType int32
LevelType int32
NextLevel int32
PreLevel int32
LayerNum int32
MonsterLv []int32
MonsterHp []float32
@ -42,7 +42,7 @@ func (_v *GamePagodaData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["key"].(float64); !_ok_ { err = errors.New("key error"); return }; _v.Key = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["pagoda_type"].(float64); !_ok_ { err = errors.New("pagoda_type error"); return }; _v.PagodaType = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["Level_type"].(float64); !_ok_ { err = errors.New("Level_type error"); return }; _v.LevelType = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["NextLevel"].(float64); !_ok_ { err = errors.New("NextLevel error"); return }; _v.NextLevel = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["PreLevel"].(float64); !_ok_ { err = errors.New("PreLevel error"); return }; _v.PreLevel = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["layer_num"].(float64); !_ok_ { err = errors.New("layer_num error"); return }; _v.LayerNum = int32(_tempNum_) }
{
var _arr_ []interface{}