From 5691ecc4caaf63cdce60b7ed8f10b39946af27ff Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Mon, 25 Dec 2023 18:31:07 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=AF=E5=88=86boss=20=E6=8E=A8=E8=8D=90?= =?UTF-8?q?=E9=98=B5=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/const.go | 3 + modules/hero/api_rank.go | 17 ++- modules/integral/api_rank.go | 57 +++++++++ modules/integral/model_integral.go | 11 +- modules/integral/model_rank.go | 68 ++++++++++ modules/integral/module.go | 3 + pb/hero_msg.pb.go | 6 +- pb/integral_db.pb.go | 197 ++++++++++++++++++++++------- pb/integral_msg.pb.go | 172 ++++++++++++++++++++++--- 9 files changed, 462 insertions(+), 72 deletions(-) create mode 100644 modules/integral/api_rank.go create mode 100644 modules/integral/model_rank.go diff --git a/comm/const.go b/comm/const.go index 2985b7a7e..75dbd9dab 100644 --- a/comm/const.go +++ b/comm/const.go @@ -440,6 +440,9 @@ const ( TableEntertainRecode = "xxlrecode" //战报 TableDrawRecode = "drawrecode" //抽卡记录 + + // 积分boss 排行 + TableIntegralRank = "integralrank" //排名 ) // RPC服务接口定义处 diff --git a/modules/hero/api_rank.go b/modules/hero/api_rank.go index f768d17b7..160531ec4 100644 --- a/modules/hero/api_rank.go +++ b/modules/hero/api_rank.go @@ -12,12 +12,25 @@ func (this *apiComp) DrawRecordCheck(session comm.IUserSession, req *pb.HeroDraw } func (this *apiComp) DrawRecord(session comm.IUserSession, req *pb.HeroDrawRecordReq) (errdata *pb.ErrorData) { - var () + var ( + results []*pb.DBHeroDrawRecord + err error + ) if errdata = this.DrawRecordCheck(session, req); errdata != nil { return } - session.SendMsg(string(this.module.GetType()), "drawrecord", &pb.HeroDrawRecordResp{}) + if results, err = this.module.modelDrawRecode.getDrawCardRecord(session.GetUserId()); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } + return + } + session.SendMsg(string(this.module.GetType()), "drawrecord", &pb.HeroDrawRecordResp{ + Record: results, + }) return } diff --git a/modules/integral/api_rank.go b/modules/integral/api_rank.go new file mode 100644 index 000000000..fac3984b4 --- /dev/null +++ b/modules/integral/api_rank.go @@ -0,0 +1,57 @@ +package integral + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/pb" +) + +// 参数校验 +func (this *apiComp) RankListCheck(session comm.IUserSession, req *pb.IntegralRankListReq) (errdata *pb.ErrorData) { + + return +} + +// /排行榜获取 +func (this *apiComp) RankList(session comm.IUserSession, req *pb.IntegralRankListReq) (errdata *pb.ErrorData) { + var ( + uids []string + ranks []*pb.DBIntegralBoss + players []*pb.DBIntegralRank + err error + ) + + if errdata = this.RankListCheck(session, req); errdata != nil { + return + } + + if uids, err = this.module.modelRank.queryRankUser(); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } + return + } + if ranks, err = this.module.modelIntegral.queryPlayers(uids); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } + return + } + players = make([]*pb.DBIntegralRank, len(ranks)) + for i, v := range ranks { + // rank := int32(i + 1) + players[i] = &pb.DBIntegralRank{ + Id: v.Uid, + Uinfo: v.Uinfo, + Nandu: v.Nandu, + Score: v.Maxscore, + } + } + session.SendMsg(string(this.module.GetType()), "rank", &pb.IntegralRankListResp{ + Ranks: players, + }) + return +} diff --git a/modules/integral/model_integral.go b/modules/integral/model_integral.go index d3600d4eb..429eccc36 100644 --- a/modules/integral/model_integral.go +++ b/modules/integral/model_integral.go @@ -35,6 +35,15 @@ func (this *modelIntegral) modifyIntegralData(uid string, data map[string]interf return this.Change(uid, data) } +func (this *modelIntegral) queryPlayers(uIds []string) (result []*pb.DBIntegralBoss, err error) { + result = make([]*pb.DBIntegralBoss, 0) + if _, err = this.Gets(uIds, &result); err != nil && err != mgo.MongodbNil { + this.module.Errorln(err) + return + } + return +} + // 获取列表信息 func (this *modelIntegral) getIntegralList(uid string) (result *pb.DBIntegralBoss, err error) { result = &pb.DBIntegralBoss{} @@ -51,7 +60,7 @@ func (this *modelIntegral) getIntegralList(uid string) (result *pb.DBIntegralBos openTime := this.module.service.GetOpentime().Unix() for _, v := range szConf { if curTime >= int64(v.Openday)+openTime && curTime <= int64(v.Endday)+openTime { - result.Hid = v.Endday + result.Hid = v.Hdid result.Etime = int64(v.Endday) + openTime result.CTime = curTime break diff --git a/modules/integral/model_rank.go b/modules/integral/model_rank.go new file mode 100644 index 000000000..860351dd2 --- /dev/null +++ b/modules/integral/model_rank.go @@ -0,0 +1,68 @@ +package integral + +import ( + "context" + "go_dreamfactory/comm" + "go_dreamfactory/lego/core" + "go_dreamfactory/lego/sys/redis/pipe" + "go_dreamfactory/modules" + "go_dreamfactory/pb" + + "github.com/go-redis/redis/v8" +) + +type modelRank struct { + modules.MCompModel + module *Integral +} + +// 组件初始化接口 +func (this *modelRank) Init(service core.IService, module core.IModule, comp core.IModuleComp, opt core.IModuleOptions) (err error) { + this.TableName = comm.TableIntegralRank + this.MCompModel.Init(service, module, comp, opt) + this.module = module.(*Integral) + + return +} + +// 更新排名 +func (this *modelRank) updateRank(data *pb.DBIntegralRank) (err error) { + var ( + pipe *pipe.RedisPipe = this.DBModel.Redis.RedisPipe(context.TODO()) + menbers *redis.Z + cmd *redis.IntCmd + ) + + menbers = &redis.Z{Score: float64(data.Score), Member: data.Uinfo.Uid} + + if cmd = pipe.ZAdd(this.TableName, menbers); err != nil { + this.module.Errorln(err) + } + + if _, err = pipe.Exec(); err != nil { + this.module.Errorln(err) + return + } + if _, err = cmd.Result(); err != nil { + this.module.Errorln(err) + return + } + + return +} + +// 获取排行榜前50的用户名单 +func (this *modelRank) queryRankUser() (ranks []string, err error) { + var ( + result []string + ) + if result, err = this.DBModel.Redis.ZRevRange(this.TableName, 0, 50).Result(); err != nil { + this.module.Errorln(err) + return + } + ranks = make([]string, 0) + for i := 0; i < len(result); i += 1 { + ranks = append(ranks, result[i]) + } + return +} diff --git a/modules/integral/module.go b/modules/integral/module.go index 36116d445..635989379 100644 --- a/modules/integral/module.go +++ b/modules/integral/module.go @@ -17,6 +17,8 @@ type Integral struct { battle comm.IBattle service base.IRPCXService + + modelRank *modelRank } func NewModule() core.IModule { @@ -53,6 +55,7 @@ func (this *Integral) OnInstallComp() { this.api = this.RegisterComp(new(apiComp)).(*apiComp) this.modelIntegral = this.RegisterComp(new(modelIntegral)).(*modelIntegral) this.configure = this.RegisterComp(new(configureComp)).(*configureComp) + this.modelRank = this.RegisterComp(new(modelRank)).(*modelRank) } // 任务条件达成通知 diff --git a/pb/hero_msg.pb.go b/pb/hero_msg.pb.go index d403da9a3..45cb22e67 100644 --- a/pb/hero_msg.pb.go +++ b/pb/hero_msg.pb.go @@ -2295,7 +2295,7 @@ type HeroDrawRecordResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Record *DBHeroDrawRecord `protobuf:"bytes,1,opt,name=record,proto3" json:"record"` // 扩展数据 + Record []*DBHeroDrawRecord `protobuf:"bytes,1,rep,name=record,proto3" json:"record"` } func (x *HeroDrawRecordResp) Reset() { @@ -2330,7 +2330,7 @@ func (*HeroDrawRecordResp) Descriptor() ([]byte, []int) { return file_hero_hero_msg_proto_rawDescGZIP(), []int{44} } -func (x *HeroDrawRecordResp) GetRecord() *DBHeroDrawRecord { +func (x *HeroDrawRecordResp) GetRecord() []*DBHeroDrawRecord { if x != nil { return x.Record } @@ -2550,7 +2550,7 @@ var file_hero_hero_msg_proto_rawDesc = []byte{ 0x65, 0x72, 0x6f, 0x44, 0x72, 0x61, 0x77, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71, 0x22, 0x3f, 0x0a, 0x12, 0x48, 0x65, 0x72, 0x6f, 0x44, 0x72, 0x61, 0x77, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x29, 0x0a, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x44, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x44, 0x72, 0x61, 0x77, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, diff --git a/pb/integral_db.pb.go b/pb/integral_db.pb.go index 1a4bca67b..0749efd05 100644 --- a/pb/integral_db.pb.go +++ b/pb/integral_db.pb.go @@ -39,6 +39,7 @@ type DBIntegralBoss struct { Buff map[int32]int32 `protobuf:"bytes,12,rep,name=buff,proto3" json:"buff" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 激活的buff (key Integralcondition value :0 未激活) 注:事件类型 才有值 Nandu int32 `protobuf:"varint,13,opt,name=nandu,proto3" json:"nandu"` // 已经解锁的难度 Score map[int32]int32 `protobuf:"bytes,14,rep,name=score,proto3" json:"score" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // key 难度 value 积分 + Uinfo *BaseUserInfo `protobuf:"bytes,15,opt,name=uinfo,proto3" json:"uinfo"` //用户基础 } func (x *DBIntegralBoss) Reset() { @@ -171,44 +172,133 @@ func (x *DBIntegralBoss) GetScore() map[int32]int32 { return nil } +func (x *DBIntegralBoss) GetUinfo() *BaseUserInfo { + if x != nil { + return x.Uinfo + } + return nil +} + +// 积分boss 排行 +type DBIntegralRank struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID + Uinfo *BaseUserInfo `protobuf:"bytes,2,opt,name=uinfo,proto3" json:"uinfo"` //用户基础 + Nandu int32 `protobuf:"varint,3,opt,name=nandu,proto3" json:"nandu"` + Score int32 `protobuf:"varint,4,opt,name=score,proto3" json:"score"` // 积分 +} + +func (x *DBIntegralRank) Reset() { + *x = DBIntegralRank{} + if protoimpl.UnsafeEnabled { + mi := &file_integral_integral_db_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DBIntegralRank) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DBIntegralRank) ProtoMessage() {} + +func (x *DBIntegralRank) ProtoReflect() protoreflect.Message { + mi := &file_integral_integral_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 DBIntegralRank.ProtoReflect.Descriptor instead. +func (*DBIntegralRank) Descriptor() ([]byte, []int) { + return file_integral_integral_db_proto_rawDescGZIP(), []int{1} +} + +func (x *DBIntegralRank) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *DBIntegralRank) GetUinfo() *BaseUserInfo { + if x != nil { + return x.Uinfo + } + return nil +} + +func (x *DBIntegralRank) GetNandu() int32 { + if x != nil { + return x.Nandu + } + return 0 +} + +func (x *DBIntegralRank) GetScore() int32 { + if x != nil { + return x.Score + } + return 0 +} + var File_integral_integral_db_proto protoreflect.FileDescriptor var file_integral_integral_db_proto_rawDesc = []byte{ 0x0a, 0x1a, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x67, - 0x72, 0x61, 0x6c, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf6, 0x03, 0x0a, - 0x0e, 0x44, 0x42, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x42, 0x6f, 0x73, 0x73, 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, 0x14, 0x0a, 0x05, 0x69, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x05, 0x69, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a, - 0x05, 0x63, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x54, - 0x69, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x05, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x68, 0x69, 0x64, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x68, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6d, - 0x61, 0x78, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x6d, - 0x61, 0x78, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, - 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x74, 0x6f, 0x74, - 0x61, 0x6c, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x77, 0x61, 0x72, - 0x64, 0x31, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, - 0x31, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x32, 0x18, 0x0b, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x07, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x32, 0x12, 0x2d, 0x0a, 0x04, 0x62, - 0x75, 0x66, 0x66, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x44, 0x42, 0x49, 0x6e, - 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x42, 0x6f, 0x73, 0x73, 0x2e, 0x42, 0x75, 0x66, 0x66, 0x45, - 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x62, 0x75, 0x66, 0x66, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x61, - 0x6e, 0x64, 0x75, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6e, 0x61, 0x6e, 0x64, 0x75, - 0x12, 0x30, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x1a, 0x2e, 0x44, 0x42, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x42, 0x6f, 0x73, 0x73, - 0x2e, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x73, 0x63, 0x6f, - 0x72, 0x65, 0x1a, 0x37, 0x0a, 0x09, 0x42, 0x75, 0x66, 0x66, 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, 0x05, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x38, 0x0a, 0x0a, 0x53, - 0x63, 0x6f, 0x72, 0x65, 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, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x61, 0x6c, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0a, 0x63, 0x6f, + 0x6d, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9b, 0x04, 0x0a, 0x0e, 0x44, 0x42, 0x49, + 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x42, 0x6f, 0x73, 0x73, 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, 0x14, 0x0a, + 0x05, 0x69, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x74, + 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x54, 0x69, + 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x54, 0x69, 0x6d, 0x65, 0x12, + 0x14, 0x0a, 0x05, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, + 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x68, 0x69, 0x64, 0x18, 0x07, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x03, 0x68, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x73, 0x63, + 0x6f, 0x72, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x73, 0x63, + 0x6f, 0x72, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x73, 0x63, 0x6f, 0x72, + 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x73, 0x63, + 0x6f, 0x72, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x31, 0x18, 0x0a, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x31, 0x12, 0x18, 0x0a, + 0x07, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x32, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, + 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x32, 0x12, 0x2d, 0x0a, 0x04, 0x62, 0x75, 0x66, 0x66, 0x18, + 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x44, 0x42, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, + 0x61, 0x6c, 0x42, 0x6f, 0x73, 0x73, 0x2e, 0x42, 0x75, 0x66, 0x66, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x52, 0x04, 0x62, 0x75, 0x66, 0x66, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x61, 0x6e, 0x64, 0x75, 0x18, + 0x0d, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6e, 0x61, 0x6e, 0x64, 0x75, 0x12, 0x30, 0x0a, 0x05, + 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x44, 0x42, + 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x42, 0x6f, 0x73, 0x73, 0x2e, 0x53, 0x63, 0x6f, + 0x72, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x23, + 0x0a, 0x05, 0x75, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, + 0x42, 0x61, 0x73, 0x65, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x75, 0x69, + 0x6e, 0x66, 0x6f, 0x1a, 0x37, 0x0a, 0x09, 0x42, 0x75, 0x66, 0x66, 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, + 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x38, 0x0a, 0x0a, + 0x53, 0x63, 0x6f, 0x72, 0x65, 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, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x71, 0x0a, 0x0e, 0x44, 0x42, 0x49, 0x6e, 0x74, 0x65, + 0x67, 0x72, 0x61, 0x6c, 0x52, 0x61, 0x6e, 0x6b, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x23, 0x0a, 0x05, 0x75, 0x69, 0x6e, 0x66, + 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x55, 0x73, + 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x75, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x14, 0x0a, + 0x05, 0x6e, 0x61, 0x6e, 0x64, 0x75, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6e, 0x61, + 0x6e, 0x64, 0x75, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, + 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -223,20 +313,24 @@ func file_integral_integral_db_proto_rawDescGZIP() []byte { return file_integral_integral_db_proto_rawDescData } -var file_integral_integral_db_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_integral_integral_db_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_integral_integral_db_proto_goTypes = []interface{}{ (*DBIntegralBoss)(nil), // 0: DBIntegralBoss - nil, // 1: DBIntegralBoss.BuffEntry - nil, // 2: DBIntegralBoss.ScoreEntry + (*DBIntegralRank)(nil), // 1: DBIntegralRank + nil, // 2: DBIntegralBoss.BuffEntry + nil, // 3: DBIntegralBoss.ScoreEntry + (*BaseUserInfo)(nil), // 4: BaseUserInfo } var file_integral_integral_db_proto_depIdxs = []int32{ - 1, // 0: DBIntegralBoss.buff:type_name -> DBIntegralBoss.BuffEntry - 2, // 1: DBIntegralBoss.score:type_name -> DBIntegralBoss.ScoreEntry - 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 + 2, // 0: DBIntegralBoss.buff:type_name -> DBIntegralBoss.BuffEntry + 3, // 1: DBIntegralBoss.score:type_name -> DBIntegralBoss.ScoreEntry + 4, // 2: DBIntegralBoss.uinfo:type_name -> BaseUserInfo + 4, // 3: DBIntegralRank.uinfo:type_name -> BaseUserInfo + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name } func init() { file_integral_integral_db_proto_init() } @@ -244,6 +338,7 @@ func file_integral_integral_db_proto_init() { if File_integral_integral_db_proto != nil { return } + file_comm_proto_init() if !protoimpl.UnsafeEnabled { file_integral_integral_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DBIntegralBoss); i { @@ -257,6 +352,18 @@ func file_integral_integral_db_proto_init() { return nil } } + file_integral_integral_db_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DBIntegralRank); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -264,7 +371,7 @@ func file_integral_integral_db_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_integral_integral_db_proto_rawDesc, NumEnums: 0, - NumMessages: 3, + NumMessages: 4, NumExtensions: 0, NumServices: 0, }, diff --git a/pb/integral_msg.pb.go b/pb/integral_msg.pb.go index 7e5a5dfd0..6083e36b9 100644 --- a/pb/integral_msg.pb.go +++ b/pb/integral_msg.pb.go @@ -430,6 +430,101 @@ func (x *IntegralGetRewardResp) GetAward() []*UserAtno { return nil } +// 获取排行榜 +type IntegralRankListReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Nandu int32 `protobuf:"varint,1,opt,name=nandu,proto3" json:"nandu"` // 难度 +} + +func (x *IntegralRankListReq) Reset() { + *x = IntegralRankListReq{} + if protoimpl.UnsafeEnabled { + mi := &file_integral_integral_msg_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IntegralRankListReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IntegralRankListReq) ProtoMessage() {} + +func (x *IntegralRankListReq) ProtoReflect() protoreflect.Message { + mi := &file_integral_integral_msg_proto_msgTypes[8] + 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 IntegralRankListReq.ProtoReflect.Descriptor instead. +func (*IntegralRankListReq) Descriptor() ([]byte, []int) { + return file_integral_integral_msg_proto_rawDescGZIP(), []int{8} +} + +func (x *IntegralRankListReq) GetNandu() int32 { + if x != nil { + return x.Nandu + } + return 0 +} + +type IntegralRankListResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Ranks []*DBIntegralRank `protobuf:"bytes,1,rep,name=ranks,proto3" json:"ranks"` +} + +func (x *IntegralRankListResp) Reset() { + *x = IntegralRankListResp{} + if protoimpl.UnsafeEnabled { + mi := &file_integral_integral_msg_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IntegralRankListResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IntegralRankListResp) ProtoMessage() {} + +func (x *IntegralRankListResp) ProtoReflect() protoreflect.Message { + mi := &file_integral_integral_msg_proto_msgTypes[9] + 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 IntegralRankListResp.ProtoReflect.Descriptor instead. +func (*IntegralRankListResp) Descriptor() ([]byte, []int) { + return file_integral_integral_msg_proto_rawDescGZIP(), []int{9} +} + +func (x *IntegralRankListResp) GetRanks() []*DBIntegralRank { + if x != nil { + return x.Ranks + } + return nil +} + var File_integral_integral_msg_proto protoreflect.FileDescriptor var file_integral_integral_msg_proto_rawDesc = []byte{ @@ -474,8 +569,15 @@ var file_integral_integral_msg_proto_rawDesc = []byte{ 0x2e, 0x44, 0x42, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x42, 0x6f, 0x73, 0x73, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1f, 0x0a, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x74, 0x6e, 0x6f, 0x52, - 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x22, 0x2b, 0x0a, 0x13, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, + 0x61, 0x6c, 0x52, 0x61, 0x6e, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, + 0x05, 0x6e, 0x61, 0x6e, 0x64, 0x75, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6e, 0x61, + 0x6e, 0x64, 0x75, 0x22, 0x3d, 0x0a, 0x14, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x52, + 0x61, 0x6e, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x25, 0x0a, 0x05, 0x72, + 0x61, 0x6e, 0x6b, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x44, 0x42, 0x49, + 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x52, 0x61, 0x6e, 0x6b, 0x52, 0x05, 0x72, 0x61, 0x6e, + 0x6b, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -490,7 +592,7 @@ func file_integral_integral_msg_proto_rawDescGZIP() []byte { return file_integral_integral_msg_proto_rawDescData } -var file_integral_integral_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_integral_integral_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_integral_integral_msg_proto_goTypes = []interface{}{ (*IntegralGetListReq)(nil), // 0: IntegralGetListReq (*IntegralGetListResp)(nil), // 1: IntegralGetListResp @@ -500,25 +602,29 @@ var file_integral_integral_msg_proto_goTypes = []interface{}{ (*IntegralChallengeOverResp)(nil), // 5: IntegralChallengeOverResp (*IntegralGetRewardReq)(nil), // 6: IntegralGetRewardReq (*IntegralGetRewardResp)(nil), // 7: IntegralGetRewardResp - (*DBIntegralBoss)(nil), // 8: DBIntegralBoss - (*BattleFormation)(nil), // 9: BattleFormation - (*BattleInfo)(nil), // 10: BattleInfo - (*BattleReport)(nil), // 11: BattleReport - (*UserAtno)(nil), // 12: UserAtno + (*IntegralRankListReq)(nil), // 8: IntegralRankListReq + (*IntegralRankListResp)(nil), // 9: IntegralRankListResp + (*DBIntegralBoss)(nil), // 10: DBIntegralBoss + (*BattleFormation)(nil), // 11: BattleFormation + (*BattleInfo)(nil), // 12: BattleInfo + (*BattleReport)(nil), // 13: BattleReport + (*UserAtno)(nil), // 14: UserAtno + (*DBIntegralRank)(nil), // 15: DBIntegralRank } var file_integral_integral_msg_proto_depIdxs = []int32{ - 8, // 0: IntegralGetListResp.data:type_name -> DBIntegralBoss - 9, // 1: IntegralChallengeReq.battle:type_name -> BattleFormation - 10, // 2: IntegralChallengeResp.info:type_name -> BattleInfo - 11, // 3: IntegralChallengeOverReq.report:type_name -> BattleReport - 8, // 4: IntegralChallengeOverResp.data:type_name -> DBIntegralBoss - 8, // 5: IntegralGetRewardResp.data:type_name -> DBIntegralBoss - 12, // 6: IntegralGetRewardResp.award:type_name -> UserAtno - 7, // [7:7] is the sub-list for method output_type - 7, // [7:7] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name + 10, // 0: IntegralGetListResp.data:type_name -> DBIntegralBoss + 11, // 1: IntegralChallengeReq.battle:type_name -> BattleFormation + 12, // 2: IntegralChallengeResp.info:type_name -> BattleInfo + 13, // 3: IntegralChallengeOverReq.report:type_name -> BattleReport + 10, // 4: IntegralChallengeOverResp.data:type_name -> DBIntegralBoss + 10, // 5: IntegralGetRewardResp.data:type_name -> DBIntegralBoss + 14, // 6: IntegralGetRewardResp.award:type_name -> UserAtno + 15, // 7: IntegralRankListResp.ranks:type_name -> DBIntegralRank + 8, // [8:8] is the sub-list for method output_type + 8, // [8:8] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name } func init() { file_integral_integral_msg_proto_init() } @@ -626,6 +732,30 @@ func file_integral_integral_msg_proto_init() { return nil } } + file_integral_integral_msg_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IntegralRankListReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_integral_integral_msg_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IntegralRankListResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -633,7 +763,7 @@ func file_integral_integral_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_integral_integral_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 8, + NumMessages: 10, NumExtensions: 0, NumServices: 0, },