diff --git a/comm/const.go b/comm/const.go index d3fc125d8..fa5c8a7ef 100644 --- a/comm/const.go +++ b/comm/const.go @@ -114,6 +114,8 @@ const ( TableSeasonPagoda = "seasonpagoda" // TableViking = "viking" + // 维京远征排行榜 + TableVikingRank = "vikingrank" ) //RPC服务接口定义处 diff --git a/modules/pagoda/model_seasonpagoda.go b/modules/pagoda/model_seasonpagoda.go index 3fe57e7c6..dd6c885a8 100644 --- a/modules/pagoda/model_seasonpagoda.go +++ b/modules/pagoda/model_seasonpagoda.go @@ -50,10 +50,11 @@ func (this *ModelSeasonPagoda) modifySeasonPagodaDataByObjId(uid string, data ma // 创建一个新的塔数据 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 - } + err = this.InsertModelLogs(this.TableName, uId, []interface{}{data}) // 不需要经过redis + // if err = this.Add(uId, data); err != nil { + // this.module.Errorf("err:%v", err) + // return + // } return nil } diff --git a/modules/timer/vikingrank.go b/modules/timer/vikingrank.go new file mode 100644 index 000000000..5ede63c64 --- /dev/null +++ b/modules/timer/vikingrank.go @@ -0,0 +1,60 @@ +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 VikingRank struct { + modules.MCompModel + service core.IService +} + +//组件初始化接口 +func (this *VikingRank) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { + + this.TableName = comm.TableVikingRank + this.MCompModel.Init(service, module, comp, options) + this.service = service + return +} + +func (this *VikingRank) Start() (err error) { + err = this.MCompModel.Start() + cron.AddFunc("*/60 * * * * ?", this.Timer) //每60s执行一次 + return +} + +// 处理排行榜排序 +func (this *VikingRank) Timer() { + data := make([]interface{}, 0) // options.Find().SetLimit(comm.MaxRankList) + for i := 1; i <= 3; i++ { // boss 类型 1 2 3 后面封装 // 时间参数战斗调完后再加进来 + if _data, err := this.DB.Find(comm.TablePagodaRank, bson.M{"bosstype": i}, options.Find().SetSort(bson.M{"difficulty": -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 { + 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") + } + } + } +} diff --git a/modules/viking/api.go b/modules/viking/api.go index 26718d0de..6588a655e 100644 --- a/modules/viking/api.go +++ b/modules/viking/api.go @@ -10,6 +10,8 @@ const ( VikingChallengeResp = "challenge" VikingSkillLvResp = "skilllv" VikingGetRewardResp = "getreward" + VikingBuyResp = "buy" + VikingRankListResp = "ranklist" ) type apiComp struct { @@ -23,6 +25,7 @@ type apiComp struct { func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { err = this.MCompGate.Init(service, module, comp, options) this.module = module.(*Viking) + this.service = service return } diff --git a/modules/viking/api_buy.go b/modules/viking/api_buy.go new file mode 100644 index 000000000..d6522b1ef --- /dev/null +++ b/modules/viking/api_buy.go @@ -0,0 +1,74 @@ +package viking + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/pb" + cfg "go_dreamfactory/sys/configure/structs" + "go_dreamfactory/utils" + "time" + + "google.golang.org/protobuf/proto" +) + +//参数校验 +func (this *apiComp) BuyCheck(session comm.IUserSession, req *pb.VikingBuyReq) (code pb.ErrorCode) { + if req.Count <= 0 { + code = pb.ErrorCode_ReqParameterError + return + } + return +} + +func (this *apiComp) Buy(session comm.IUserSession, req *pb.VikingBuyReq) (code pb.ErrorCode, data proto.Message) { + var ( + curByCount int32 + costRes []*cfg.Gameatn + mapData map[string]interface{} + ) + code = this.BuyCheck(session, req) + if code != pb.ErrorCode_Success { + return // 参数校验失败直接返回 + } + list, err := this.module.modelViking.getVikingList(session.GetUserId()) + if err != nil { + code = pb.ErrorCode_DBError + return + } + + // 校验是不是今天 + if !utils.IsToday(list.CTime) { + list.CTime = time.Now().Unix() + list.BuyCount = 0 + list.ChallengeCount = 0 + + mapData["cTime"] = list.CTime + mapData["buyCount"] = list.BuyCount + mapData["challengeCount"] = list.ChallengeCount + } else { + curByCount = list.BuyCount + } + curByCount += req.Count // 当前需要购买的数量 + // + for i := list.BuyCount + 1; i <= curByCount; i++ { + _cfg := this.configure.GetBuyChallengeCount(i) + if _cfg == nil { + code = pb.ErrorCode_VikingBuyMaxCount + return + } + costRes = append(costRes, _cfg.Need...) + } + // 消耗校验 + if code = this.module.CheckRes(session, costRes); code != pb.ErrorCode_Success { + return + } + + //消耗 + if code = this.module.ConsumeRes(session, costRes, true); code != pb.ErrorCode_Success { + return + } + list.BuyCount = curByCount + mapData["buyCount"] = curByCount + code = this.module.ModifyVikingData(session.GetUserId(), mapData) + session.SendMsg(string(this.module.GetType()), VikingBuyResp, &pb.VikingBuyResp{Data: list}) + return +} diff --git a/modules/viking/api_challenge.go b/modules/viking/api_challenge.go index c49d7986b..a60b4f370 100644 --- a/modules/viking/api_challenge.go +++ b/modules/viking/api_challenge.go @@ -62,9 +62,13 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.VikingChalleng } viking.Boos[req.BossType] += 1 mapData["boos"] = viking.Boos - code = this.module.ModifyVikingData(session.GetUserId(), mapData) - } + viking.ChallengeTime[req.BossType<<16+req.Difficulty] = 0 // todo 耗时 + mapData["challengeTime"] = viking.ChallengeTime + } + // 耗时校验 当前战斗胜利时间消耗小于之前刷新数据 + viking.ChallengeTime[req.BossType<<16+req.Difficulty] = 0 + code = this.module.ModifyVikingData(session.GetUserId(), mapData) // 发放通关随机奖励 this.module.GetDropReward(cfg.Drop, reward) // 获取掉落奖励 if code = this.module.DispenseRes(session, reward, true); code != pb.ErrorCode_Success { diff --git a/modules/viking/api_getlist.go b/modules/viking/api_getlist.go index 6a32e7c5c..a9d17f20f 100644 --- a/modules/viking/api_getlist.go +++ b/modules/viking/api_getlist.go @@ -3,6 +3,8 @@ package viking import ( "go_dreamfactory/comm" "go_dreamfactory/pb" + "go_dreamfactory/utils" + "time" "go.mongodb.org/mongo-driver/bson/primitive" "google.golang.org/protobuf/proto" @@ -35,6 +37,17 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.VikingGetListReq } this.module.modelViking.Add(session.GetUserId(), list) // 写缓存 } + // 校验 是不是当天 + if !utils.IsToday(list.CTime) { + list.CTime = time.Now().Unix() + list.BuyCount = 0 + list.ChallengeCount = 0 + mapData := make(map[string]interface{}, 0) + mapData["cTime"] = list.CTime + mapData["buyCount"] = list.BuyCount + mapData["challengeCount"] = list.ChallengeCount + code = this.module.ModifyVikingData(session.GetUserId(), mapData) //修改内存信息 + } session.SendMsg(string(this.module.GetType()), VikingGetListResp, &pb.VikingGetListResp{Data: list}) return } diff --git a/modules/viking/api_ranklist.go b/modules/viking/api_ranklist.go new file mode 100644 index 000000000..71f9ddb2a --- /dev/null +++ b/modules/viking/api_ranklist.go @@ -0,0 +1,28 @@ +package viking + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/pb" + + "google.golang.org/protobuf/proto" +) + +//参数校验 +func (this *apiComp) RankListCheck(session comm.IUserSession, req *pb.VikingRankListReq) (code pb.ErrorCode) { + + return +} + +func (this *apiComp) RankList(session comm.IUserSession, req *pb.VikingRankListReq) (code pb.ErrorCode, data proto.Message) { + + code = this.RankListCheck(session, req) + if code != pb.ErrorCode_Success { + return // 参数校验失败直接返回 + } + szRank, err := this.module.modulerank.GetRankData() + if err != nil { + code = pb.ErrorCode_DBError + } + session.SendMsg(string(this.module.GetType()), VikingRankListResp, &pb.VikingRankListResp{Ranks: szRank}) + return +} diff --git a/modules/viking/comp_configure.go b/modules/viking/comp_configure.go index 1717731d0..8af0cfc96 100644 --- a/modules/viking/comp_configure.go +++ b/modules/viking/comp_configure.go @@ -12,6 +12,7 @@ import ( const ( game_vikingboss = "game_vikingboss.json" + game_challenge = "game_vikingchallenge.json" ) ///配置管理基础组件 @@ -38,10 +39,13 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp return } } - log.Errorf("get game_pagoda conf err:%v", err) + log.Errorf("get game_viking conf err:%v", err) return }) + err = this.LoadConfigure(game_challenge, cfg.NewGameVikingChallenge) + // _data := this.GetBuyChallengeCount(1) + // log.Debugf("%v", _data) return } @@ -86,3 +90,16 @@ func (this *configureComp) GetVikingBossTypeConfigData() (mapType map[int32]stru } return } + +func (this *configureComp) GetBuyChallengeCount(index int32) (data *cfg.GameVikingChallengeData) { + if v, err := this.GetConfigure(game_challenge); err == nil { + if configure, ok := v.(*cfg.GameVikingChallenge); ok { + data = configure.Get(index) + return + } + } else { + log.Errorf("get game_challenge conf err:%v", err) + } + + return +} diff --git a/modules/viking/model_rank.go b/modules/viking/model_rank.go new file mode 100644 index 000000000..c7877ea4f --- /dev/null +++ b/modules/viking/model_rank.go @@ -0,0 +1,62 @@ +package viking + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/lego/core" + "go_dreamfactory/lego/sys/redis" + "go_dreamfactory/modules" + "go_dreamfactory/pb" +) + +type ModelRank struct { + modules.MCompModel + moduleUser *Viking +} + +func (this *ModelRank) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { + this.TableName = comm.TableVikingRank + err = this.MCompModel.Init(service, module, comp, options) + this.moduleUser = module.(*Viking) + return +} + +//获取用户 +func (this *ModelRank) getUserSession(uid string) (cuser *pb.CacheUser) { + cuser = &pb.CacheUser{} + if err := this.Get(uid, cuser); err != nil { + this.moduleUser.Errorf("GetUserSession err:%v", err) + return + } + return +} + +func (this *ModelRank) AddRank(uId string, data *pb.DBVikingRank) (err error) { + if err = this.Add(uId, data); err != nil { + return + } + return nil +} + +func (this *ModelRank) GetUserRandData(uid string) (result *pb.DBVikingRank, err error) { + result = &pb.DBVikingRank{} + if err = this.Get(uid, result); err != nil && redis.RedisNil != err { + return + } + err = nil + return result, err +} + +// 更新排行榜数据 +func (this *ModelRank) ChangeUserRank(uid string, value map[string]interface{}) (err error) { + if len(value) == 0 { + return nil + } + return this.Change(uid, value) +} + +func (this *ModelRank) GetRankData() (data []*pb.DBVikingRank, err error) { + data = make([]*pb.DBVikingRank, 0) + err = this.Redis.LRange(comm.TableVikingRank, 0, -1, &data) + + return +} diff --git a/modules/viking/module.go b/modules/viking/module.go index f86aa7fef..e64143ddc 100644 --- a/modules/viking/module.go +++ b/modules/viking/module.go @@ -18,6 +18,7 @@ type Viking struct { modelViking *modelViking api *apiComp configure *configureComp + modulerank *ModelRank } func NewModule() core.IModule { @@ -38,6 +39,7 @@ func (this *Viking) OnInstallComp() { this.ModuleBase.OnInstallComp() this.api = this.RegisterComp(new(apiComp)).(*apiComp) this.modelViking = this.RegisterComp(new(modelViking)).(*modelViking) + this.modulerank = this.RegisterComp(new(ModelRank)).(*ModelRank) this.configure = this.RegisterComp(new(configureComp)).(*configureComp) } diff --git a/pb/errorcode.pb.go b/pb/errorcode.pb.go index ae60cac36..109624ffb 100644 --- a/pb/errorcode.pb.go +++ b/pb/errorcode.pb.go @@ -113,6 +113,7 @@ const ( ErrorCode_EquipmentOnFoundEquipment ErrorCode = 1400 // 未找到武器 ErrorCode_EquipmentLvlimitReached ErrorCode = 1401 // 武器等级已达上限 ErrorCode_EquipmentIsWorn ErrorCode = 1402 // 武器已经穿戴 + ErrorCode_EquipmentNoCanSell ErrorCode = 1403 // 装备不能出售 // mainMainline ErrorCode_MainlineNotFindChapter ErrorCode = 1500 // 没有找到主线关卡信息 ErrorCode_MainlineIDFailed ErrorCode = 1501 // 关卡ID 错误 @@ -160,8 +161,9 @@ const ( ErrorCode_RtaskCondiNoReach ErrorCode = 2206 //未达到限定条件 ErrorCode_RtaskNoLastOne ErrorCode = 2207 //不是最后一个任务 // viking - ErrorCode_VikingLvErr ErrorCode = 2301 // 关卡难度不匹配 - ErrorCode_VikingBoosType ErrorCode = 2302 // BOSS 类型不对 + ErrorCode_VikingLvErr ErrorCode = 2301 // 关卡难度不匹配 + ErrorCode_VikingBoosType ErrorCode = 2302 // BOSS 类型不对 + ErrorCode_VikingBuyMaxCount ErrorCode = 2303 // 购买达到最大次数 ) // Enum value maps for ErrorCode. @@ -252,6 +254,7 @@ var ( 1400: "EquipmentOnFoundEquipment", 1401: "EquipmentLvlimitReached", 1402: "EquipmentIsWorn", + 1403: "EquipmentNoCanSell", 1500: "MainlineNotFindChapter", 1501: "MainlineIDFailed", 1502: "MainlineNotFound", @@ -292,6 +295,7 @@ var ( 2207: "RtaskNoLastOne", 2301: "VikingLvErr", 2302: "VikingBoosType", + 2303: "VikingBuyMaxCount", } ErrorCode_value = map[string]int32{ "Success": 0, @@ -379,6 +383,7 @@ var ( "EquipmentOnFoundEquipment": 1400, "EquipmentLvlimitReached": 1401, "EquipmentIsWorn": 1402, + "EquipmentNoCanSell": 1403, "MainlineNotFindChapter": 1500, "MainlineIDFailed": 1501, "MainlineNotFound": 1502, @@ -419,6 +424,7 @@ var ( "RtaskNoLastOne": 2207, "VikingLvErr": 2301, "VikingBoosType": 2302, + "VikingBuyMaxCount": 2303, } ) @@ -453,7 +459,7 @@ var File_errorcode_proto protoreflect.FileDescriptor var file_errorcode_proto_rawDesc = []byte{ 0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2a, 0x82, 0x15, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, + 0x6f, 0x2a, 0xb3, 0x15, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x10, 0x0a, 0x12, 0x1b, 0x0a, 0x17, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, @@ -565,64 +571,67 @@ var file_errorcode_proto_rawDesc = []byte{ 0x10, 0xf8, 0x0a, 0x12, 0x1c, 0x0a, 0x17, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x4c, 0x76, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x61, 0x63, 0x68, 0x65, 0x64, 0x10, 0xf9, 0x0a, 0x12, 0x14, 0x0a, 0x0f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x73, - 0x57, 0x6f, 0x72, 0x6e, 0x10, 0xfa, 0x0a, 0x12, 0x1b, 0x0a, 0x16, 0x4d, 0x61, 0x69, 0x6e, 0x6c, - 0x69, 0x6e, 0x65, 0x4e, 0x6f, 0x74, 0x46, 0x69, 0x6e, 0x64, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, - 0x72, 0x10, 0xdc, 0x0b, 0x12, 0x15, 0x0a, 0x10, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, - 0x49, 0x44, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x10, 0xdd, 0x0b, 0x12, 0x15, 0x0a, 0x10, 0x4d, - 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, - 0xde, 0x0b, 0x12, 0x18, 0x0a, 0x13, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x50, 0x72, - 0x65, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xdf, 0x0b, 0x12, 0x19, 0x0a, 0x14, - 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x52, 0x65, - 0x77, 0x61, 0x72, 0x64, 0x10, 0xe0, 0x0b, 0x12, 0x1b, 0x0a, 0x16, 0x4d, 0x61, 0x69, 0x6e, 0x6c, - 0x69, 0x6e, 0x65, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x77, 0x61, 0x72, - 0x64, 0x10, 0xe1, 0x0b, 0x12, 0x0d, 0x0a, 0x08, 0x54, 0x61, 0x73, 0x6b, 0x49, 0x6e, 0x69, 0x74, - 0x10, 0xc0, 0x0c, 0x12, 0x0e, 0x0a, 0x09, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x73, 0x65, 0x74, - 0x10, 0xc1, 0x0c, 0x12, 0x0f, 0x0a, 0x0a, 0x54, 0x61, 0x73, 0x6b, 0x48, 0x61, 0x6e, 0x64, 0x6c, - 0x65, 0x10, 0xc2, 0x0c, 0x12, 0x11, 0x0a, 0x0c, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x63, 0x65, - 0x69, 0x76, 0x65, 0x64, 0x10, 0xc3, 0x0c, 0x12, 0x13, 0x0a, 0x0e, 0x54, 0x61, 0x73, 0x6b, 0x41, - 0x63, 0x74, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x69, 0x74, 0x10, 0xc4, 0x0c, 0x12, 0x16, 0x0a, 0x11, - 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x4e, 0x6f, 0x66, 0x6f, 0x75, 0x6e, - 0x64, 0x10, 0xc5, 0x0c, 0x12, 0x17, 0x0a, 0x12, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, - 0x76, 0x65, 0x4e, 0x6f, 0x65, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xc6, 0x0c, 0x12, 0x13, 0x0a, - 0x0e, 0x54, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x10, - 0xc7, 0x0c, 0x12, 0x11, 0x0a, 0x0c, 0x54, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, - 0x65, 0x64, 0x10, 0xc8, 0x0c, 0x12, 0x11, 0x0a, 0x0c, 0x54, 0x61, 0x73, 0x6b, 0x54, 0x61, 0x67, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x10, 0xc9, 0x0c, 0x12, 0x10, 0x0a, 0x0b, 0x54, 0x61, 0x73, 0x6b, - 0x49, 0x64, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x10, 0xca, 0x0c, 0x12, 0x11, 0x0a, 0x0c, 0x54, 0x61, - 0x73, 0x6b, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xcb, 0x0c, 0x12, 0x17, 0x0a, - 0x12, 0x53, 0x68, 0x6f, 0x70, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x49, 0x73, 0x53, 0x6f, 0x6c, 0x64, - 0x4f, 0x75, 0x74, 0x10, 0xa4, 0x0d, 0x12, 0x1c, 0x0a, 0x17, 0x53, 0x68, 0x6f, 0x70, 0x4e, 0x6f, - 0x53, 0x75, 0x72, 0x70, 0x6c, 0x75, 0x73, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x4e, 0x75, - 0x6d, 0x10, 0xa5, 0x0d, 0x12, 0x0c, 0x0a, 0x07, 0x4d, 0x61, 0x69, 0x6c, 0x45, 0x72, 0x72, 0x10, - 0x88, 0x0e, 0x12, 0x13, 0x0a, 0x0e, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x4e, 0x6f, 0x74, 0x46, - 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xec, 0x0e, 0x12, 0x12, 0x0a, 0x0d, 0x50, 0x61, 0x67, 0x6f, 0x64, - 0x61, 0x4c, 0x65, 0x76, 0x6c, 0x45, 0x72, 0x72, 0x10, 0xed, 0x0e, 0x12, 0x17, 0x0a, 0x12, 0x50, - 0x61, 0x67, 0x6f, 0x64, 0x61, 0x47, 0x65, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x45, 0x72, - 0x72, 0x10, 0xee, 0x0e, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x43, 0x6f, - 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x72, 0x72, 0x10, 0xef, 0x0e, 0x12, 0x1b, 0x0a, - 0x16, 0x4d, 0x61, 0x72, 0x74, 0x69, 0x61, 0x6c, 0x68, 0x61, 0x6c, 0x6c, 0x4e, 0x6f, 0x74, 0x55, - 0x6e, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x10, 0xd0, 0x0f, 0x12, 0x15, 0x0a, 0x10, 0x4d, 0x61, - 0x72, 0x74, 0x69, 0x61, 0x6c, 0x68, 0x61, 0x6c, 0x6c, 0x49, 0x6e, 0x55, 0x73, 0x65, 0x10, 0xd1, - 0x0f, 0x12, 0x18, 0x0a, 0x13, 0x4d, 0x61, 0x72, 0x74, 0x69, 0x61, 0x6c, 0x68, 0x61, 0x6c, 0x6c, - 0x55, 0x6e, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x10, 0xd2, 0x0f, 0x12, 0x1a, 0x0a, 0x15, 0x4d, - 0x61, 0x72, 0x74, 0x69, 0x61, 0x6c, 0x68, 0x61, 0x6c, 0x6c, 0x4e, 0x6f, 0x55, 0x6e, 0x6c, 0x6f, - 0x63, 0x6b, 0x65, 0x64, 0x10, 0xd3, 0x0f, 0x12, 0x19, 0x0a, 0x14, 0x47, 0x6f, 0x75, 0x72, 0x6d, - 0x65, 0x74, 0x4d, 0x6f, 0x72, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x54, 0x69, 0x6d, 0x65, 0x10, - 0xb5, 0x10, 0x12, 0x16, 0x0a, 0x11, 0x47, 0x6f, 0x75, 0x72, 0x6d, 0x65, 0x74, 0x53, 0x6b, 0x69, - 0x6c, 0x6c, 0x4d, 0x61, 0x78, 0x4c, 0x76, 0x10, 0xb6, 0x10, 0x12, 0x12, 0x0a, 0x0d, 0x52, 0x74, - 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x10, 0x99, 0x11, 0x12, 0x14, - 0x0a, 0x0f, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x55, 0x6e, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, - 0x64, 0x10, 0x9a, 0x11, 0x12, 0x11, 0x0a, 0x0c, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x52, - 0x74, 0x61, 0x73, 0x6b, 0x10, 0x9b, 0x11, 0x12, 0x12, 0x0a, 0x0d, 0x52, 0x74, 0x61, 0x73, 0x6b, - 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x65, 0x64, 0x10, 0x9c, 0x11, 0x12, 0x15, 0x0a, 0x10, 0x52, - 0x74, 0x61, 0x73, 0x6b, 0x50, 0x72, 0x65, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x10, - 0x9d, 0x11, 0x12, 0x16, 0x0a, 0x11, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x43, 0x6f, 0x6e, 0x64, 0x69, - 0x4e, 0x6f, 0x52, 0x65, 0x61, 0x63, 0x68, 0x10, 0x9e, 0x11, 0x12, 0x13, 0x0a, 0x0e, 0x52, 0x74, - 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x4c, 0x61, 0x73, 0x74, 0x4f, 0x6e, 0x65, 0x10, 0x9f, 0x11, 0x12, - 0x10, 0x0a, 0x0b, 0x56, 0x69, 0x6b, 0x69, 0x6e, 0x67, 0x4c, 0x76, 0x45, 0x72, 0x72, 0x10, 0xfd, - 0x11, 0x12, 0x13, 0x0a, 0x0e, 0x56, 0x69, 0x6b, 0x69, 0x6e, 0x67, 0x42, 0x6f, 0x6f, 0x73, 0x54, - 0x79, 0x70, 0x65, 0x10, 0xfe, 0x11, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x57, 0x6f, 0x72, 0x6e, 0x10, 0xfa, 0x0a, 0x12, 0x17, 0x0a, 0x12, 0x45, 0x71, 0x75, 0x69, 0x70, + 0x6d, 0x65, 0x6e, 0x74, 0x4e, 0x6f, 0x43, 0x61, 0x6e, 0x53, 0x65, 0x6c, 0x6c, 0x10, 0xfb, 0x0a, + 0x12, 0x1b, 0x0a, 0x16, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x4e, 0x6f, 0x74, 0x46, + 0x69, 0x6e, 0x64, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x10, 0xdc, 0x0b, 0x12, 0x15, 0x0a, + 0x10, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x49, 0x44, 0x46, 0x61, 0x69, 0x6c, 0x65, + 0x64, 0x10, 0xdd, 0x0b, 0x12, 0x15, 0x0a, 0x10, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, + 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xde, 0x0b, 0x12, 0x18, 0x0a, 0x13, 0x4d, + 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x50, 0x72, 0x65, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, + 0x6e, 0x64, 0x10, 0xdf, 0x0b, 0x12, 0x19, 0x0a, 0x14, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, + 0x65, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x10, 0xe0, 0x0b, + 0x12, 0x1b, 0x0a, 0x16, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x43, 0x6f, 0x6d, 0x70, + 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x10, 0xe1, 0x0b, 0x12, 0x0d, 0x0a, + 0x08, 0x54, 0x61, 0x73, 0x6b, 0x49, 0x6e, 0x69, 0x74, 0x10, 0xc0, 0x0c, 0x12, 0x0e, 0x0a, 0x09, + 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x73, 0x65, 0x74, 0x10, 0xc1, 0x0c, 0x12, 0x0f, 0x0a, 0x0a, + 0x54, 0x61, 0x73, 0x6b, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x10, 0xc2, 0x0c, 0x12, 0x11, 0x0a, + 0x0c, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x10, 0xc3, 0x0c, + 0x12, 0x13, 0x0a, 0x0e, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x49, 0x6e, + 0x69, 0x74, 0x10, 0xc4, 0x0c, 0x12, 0x16, 0x0a, 0x11, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74, + 0x69, 0x76, 0x65, 0x4e, 0x6f, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xc5, 0x0c, 0x12, 0x17, 0x0a, + 0x12, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x4e, 0x6f, 0x65, 0x6e, 0x6f, + 0x75, 0x67, 0x68, 0x10, 0xc6, 0x0c, 0x12, 0x13, 0x0a, 0x0e, 0x54, 0x61, 0x73, 0x6b, 0x4e, 0x6f, + 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x10, 0xc7, 0x0c, 0x12, 0x11, 0x0a, 0x0c, 0x54, + 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x10, 0xc8, 0x0c, 0x12, 0x11, + 0x0a, 0x0c, 0x54, 0x61, 0x73, 0x6b, 0x54, 0x61, 0x67, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x10, 0xc9, + 0x0c, 0x12, 0x10, 0x0a, 0x0b, 0x54, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x45, 0x6d, 0x70, 0x74, 0x79, + 0x10, 0xca, 0x0c, 0x12, 0x11, 0x0a, 0x0c, 0x54, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x74, 0x46, 0x6f, + 0x75, 0x6e, 0x64, 0x10, 0xcb, 0x0c, 0x12, 0x17, 0x0a, 0x12, 0x53, 0x68, 0x6f, 0x70, 0x47, 0x6f, + 0x6f, 0x64, 0x73, 0x49, 0x73, 0x53, 0x6f, 0x6c, 0x64, 0x4f, 0x75, 0x74, 0x10, 0xa4, 0x0d, 0x12, + 0x1c, 0x0a, 0x17, 0x53, 0x68, 0x6f, 0x70, 0x4e, 0x6f, 0x53, 0x75, 0x72, 0x70, 0x6c, 0x75, 0x73, + 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x4e, 0x75, 0x6d, 0x10, 0xa5, 0x0d, 0x12, 0x0c, 0x0a, + 0x07, 0x4d, 0x61, 0x69, 0x6c, 0x45, 0x72, 0x72, 0x10, 0x88, 0x0e, 0x12, 0x13, 0x0a, 0x0e, 0x50, + 0x61, 0x67, 0x6f, 0x64, 0x61, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xec, 0x0e, + 0x12, 0x12, 0x0a, 0x0d, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x4c, 0x65, 0x76, 0x6c, 0x45, 0x72, + 0x72, 0x10, 0xed, 0x0e, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x47, 0x65, + 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x45, 0x72, 0x72, 0x10, 0xee, 0x0e, 0x12, 0x17, 0x0a, + 0x12, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x45, 0x72, 0x72, 0x10, 0xef, 0x0e, 0x12, 0x1b, 0x0a, 0x16, 0x4d, 0x61, 0x72, 0x74, 0x69, 0x61, + 0x6c, 0x68, 0x61, 0x6c, 0x6c, 0x4e, 0x6f, 0x74, 0x55, 0x6e, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, + 0x10, 0xd0, 0x0f, 0x12, 0x15, 0x0a, 0x10, 0x4d, 0x61, 0x72, 0x74, 0x69, 0x61, 0x6c, 0x68, 0x61, + 0x6c, 0x6c, 0x49, 0x6e, 0x55, 0x73, 0x65, 0x10, 0xd1, 0x0f, 0x12, 0x18, 0x0a, 0x13, 0x4d, 0x61, + 0x72, 0x74, 0x69, 0x61, 0x6c, 0x68, 0x61, 0x6c, 0x6c, 0x55, 0x6e, 0x6c, 0x6f, 0x63, 0x6b, 0x65, + 0x64, 0x10, 0xd2, 0x0f, 0x12, 0x1a, 0x0a, 0x15, 0x4d, 0x61, 0x72, 0x74, 0x69, 0x61, 0x6c, 0x68, + 0x61, 0x6c, 0x6c, 0x4e, 0x6f, 0x55, 0x6e, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x10, 0xd3, 0x0f, + 0x12, 0x19, 0x0a, 0x14, 0x47, 0x6f, 0x75, 0x72, 0x6d, 0x65, 0x74, 0x4d, 0x6f, 0x72, 0x65, 0x4f, + 0x72, 0x64, 0x65, 0x72, 0x54, 0x69, 0x6d, 0x65, 0x10, 0xb5, 0x10, 0x12, 0x16, 0x0a, 0x11, 0x47, + 0x6f, 0x75, 0x72, 0x6d, 0x65, 0x74, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x4d, 0x61, 0x78, 0x4c, 0x76, + 0x10, 0xb6, 0x10, 0x12, 0x12, 0x0a, 0x0d, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, + 0x73, 0x68, 0x65, 0x64, 0x10, 0x99, 0x11, 0x12, 0x14, 0x0a, 0x0f, 0x52, 0x74, 0x61, 0x73, 0x6b, + 0x55, 0x6e, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x10, 0x9a, 0x11, 0x12, 0x11, 0x0a, + 0x0c, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x10, 0x9b, 0x11, + 0x12, 0x12, 0x0a, 0x0d, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x65, + 0x64, 0x10, 0x9c, 0x11, 0x12, 0x15, 0x0a, 0x10, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x50, 0x72, 0x65, + 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x10, 0x9d, 0x11, 0x12, 0x16, 0x0a, 0x11, 0x52, + 0x74, 0x61, 0x73, 0x6b, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x4e, 0x6f, 0x52, 0x65, 0x61, 0x63, 0x68, + 0x10, 0x9e, 0x11, 0x12, 0x13, 0x0a, 0x0e, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x4c, 0x61, + 0x73, 0x74, 0x4f, 0x6e, 0x65, 0x10, 0x9f, 0x11, 0x12, 0x10, 0x0a, 0x0b, 0x56, 0x69, 0x6b, 0x69, + 0x6e, 0x67, 0x4c, 0x76, 0x45, 0x72, 0x72, 0x10, 0xfd, 0x11, 0x12, 0x13, 0x0a, 0x0e, 0x56, 0x69, + 0x6b, 0x69, 0x6e, 0x67, 0x42, 0x6f, 0x6f, 0x73, 0x54, 0x79, 0x70, 0x65, 0x10, 0xfe, 0x11, 0x12, + 0x16, 0x0a, 0x11, 0x56, 0x69, 0x6b, 0x69, 0x6e, 0x67, 0x42, 0x75, 0x79, 0x4d, 0x61, 0x78, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x10, 0xff, 0x11, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pb/viking_db.pb.go b/pb/viking_db.pb.go index 8b9f6831b..cbbca5a08 100644 --- a/pb/viking_db.pb.go +++ b/pb/viking_db.pb.go @@ -26,12 +26,13 @@ type DBViking struct { 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 - ChallengeCount int32 `protobuf:"varint,3,opt,name=challengeCount,proto3" json:"challengeCount" bson:"challengeCount"` //挑战次数 - Boos map[int32]int32 `protobuf:"bytes,4,rep,name=boos,proto3" json:"boos" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // key boos 类型 value 难度 - BuyCount int32 `protobuf:"varint,5,opt,name=buyCount,proto3" json:"buyCount" bson:"buyCount"` //购买次数 - CTime int64 `protobuf:"varint,6,opt,name=cTime,proto3" json:"cTime" bson:"cTime"` //修改时间 + 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 + ChallengeCount int32 `protobuf:"varint,3,opt,name=challengeCount,proto3" json:"challengeCount" bson:"challengeCount"` //挑战次数 + Boos map[int32]int32 `protobuf:"bytes,4,rep,name=boos,proto3" json:"boos" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // key boos 类型 value 难度 + BuyCount int32 `protobuf:"varint,5,opt,name=buyCount,proto3" json:"buyCount" bson:"buyCount"` //购买次数 + CTime int64 `protobuf:"varint,6,opt,name=cTime,proto3" json:"cTime" bson:"cTime"` //修改时间 + ChallengeTime map[int32]int32 `protobuf:"bytes,7,rep,name=challengeTime,proto3" json:"challengeTime" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"challengeTime"` //每个难度通关时间 } func (x *DBViking) Reset() { @@ -108,11 +109,122 @@ func (x *DBViking) GetCTime() int64 { return 0 } +func (x *DBViking) GetChallengeTime() map[int32]int32 { + if x != nil { + return x.ChallengeTime + } + return nil +} + +// 维京远征排行榜 +type DBVikingRank 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 + Difficulty int32 `protobuf:"varint,3,opt,name=difficulty,proto3" json:"difficulty"` // 难度 + Bosstype int32 `protobuf:"varint,4,opt,name=bosstype,proto3" json:"bosstype"` // boss类型塔类型 + 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"` //闯关耗时 单位s +} + +func (x *DBVikingRank) Reset() { + *x = DBVikingRank{} + if protoimpl.UnsafeEnabled { + mi := &file_viking_viking_db_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DBVikingRank) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DBVikingRank) ProtoMessage() {} + +func (x *DBVikingRank) ProtoReflect() protoreflect.Message { + mi := &file_viking_viking_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 DBVikingRank.ProtoReflect.Descriptor instead. +func (*DBVikingRank) Descriptor() ([]byte, []int) { + return file_viking_viking_db_proto_rawDescGZIP(), []int{1} +} + +func (x *DBVikingRank) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *DBVikingRank) GetUid() string { + if x != nil { + return x.Uid + } + return "" +} + +func (x *DBVikingRank) GetDifficulty() int32 { + if x != nil { + return x.Difficulty + } + return 0 +} + +func (x *DBVikingRank) GetBosstype() int32 { + if x != nil { + return x.Bosstype + } + return 0 +} + +func (x *DBVikingRank) GetNickname() string { + if x != nil { + return x.Nickname + } + return "" +} + +func (x *DBVikingRank) GetIcon() string { + if x != nil { + return x.Icon + } + return "" +} + +func (x *DBVikingRank) GetLv() int32 { + if x != nil { + return x.Lv + } + return 0 +} + +func (x *DBVikingRank) GetCostTime() int32 { + if x != nil { + return x.CostTime + } + return 0 +} + var File_viking_viking_db_proto protoreflect.FileDescriptor var file_viking_viking_db_proto_rawDesc = []byte{ 0x0a, 0x16, 0x76, 0x69, 0x6b, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x69, 0x6b, 0x69, 0x6e, 0x67, 0x5f, - 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe8, 0x01, 0x0a, 0x08, 0x44, 0x42, 0x56, + 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xee, 0x02, 0x0a, 0x08, 0x44, 0x42, 0x56, 0x69, 0x6b, 0x69, 0x6e, 0x67, 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, 0x26, 0x0a, 0x0e, 0x63, 0x68, 0x61, 0x6c, 0x6c, @@ -123,12 +235,33 @@ var file_viking_viking_db_proto_rawDesc = []byte{ 0x72, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x75, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x62, 0x75, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x54, 0x69, 0x6d, 0x65, 0x1a, 0x37, 0x0a, 0x09, 0x42, 0x6f, - 0x6f, 0x73, 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, + 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x42, 0x0a, 0x0d, 0x63, 0x68, + 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x1c, 0x2e, 0x44, 0x42, 0x56, 0x69, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x43, 0x68, 0x61, + 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x0d, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x1a, 0x37, + 0x0a, 0x09, 0x42, 0x6f, 0x6f, 0x73, 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, 0x40, 0x0a, 0x12, 0x43, 0x68, 0x61, 0x6c, 0x6c, + 0x65, 0x6e, 0x67, 0x65, 0x54, 0x69, 0x6d, 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, 0xc8, 0x01, 0x0a, 0x0c, 0x44, 0x42, + 0x56, 0x69, 0x6b, 0x69, 0x6e, 0x67, 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, 0x1e, 0x0a, 0x0a, + 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x0a, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x12, 0x1a, 0x0a, 0x08, + 0x62, 0x6f, 0x73, 0x73, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, + 0x62, 0x6f, 0x73, 0x73, 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 ( @@ -143,18 +276,21 @@ func file_viking_viking_db_proto_rawDescGZIP() []byte { return file_viking_viking_db_proto_rawDescData } -var file_viking_viking_db_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_viking_viking_db_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_viking_viking_db_proto_goTypes = []interface{}{ - (*DBViking)(nil), // 0: DBViking - nil, // 1: DBViking.BoosEntry + (*DBViking)(nil), // 0: DBViking + (*DBVikingRank)(nil), // 1: DBVikingRank + nil, // 2: DBViking.BoosEntry + nil, // 3: DBViking.ChallengeTimeEntry } var file_viking_viking_db_proto_depIdxs = []int32{ - 1, // 0: DBViking.boos:type_name -> DBViking.BoosEntry - 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 + 2, // 0: DBViking.boos:type_name -> DBViking.BoosEntry + 3, // 1: DBViking.challengeTime:type_name -> DBViking.ChallengeTimeEntry + 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_viking_viking_db_proto_init() } @@ -175,6 +311,18 @@ func file_viking_viking_db_proto_init() { return nil } } + file_viking_viking_db_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DBVikingRank); 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{ @@ -182,7 +330,7 @@ func file_viking_viking_db_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_viking_viking_db_proto_rawDesc, NumEnums: 0, - NumMessages: 2, + NumMessages: 4, NumExtensions: 0, NumServices: 0, }, diff --git a/pb/viking_msg.pb.go b/pb/viking_msg.pb.go index 5a2741091..194857d63 100644 --- a/pb/viking_msg.pb.go +++ b/pb/viking_msg.pb.go @@ -213,6 +213,8 @@ type VikingBuyReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + Count int32 `protobuf:"varint,1,opt,name=count,proto3" json:"count"` // 购买次数 } func (x *VikingBuyReq) Reset() { @@ -247,6 +249,13 @@ func (*VikingBuyReq) Descriptor() ([]byte, []int) { return file_viking_viking_msg_proto_rawDescGZIP(), []int{4} } +func (x *VikingBuyReq) GetCount() int32 { + if x != nil { + return x.Count + } + return 0 +} + type VikingBuyResp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -337,6 +346,8 @@ type VikingRankListResp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + Ranks []*DBVikingRank `protobuf:"bytes,1,rep,name=ranks,proto3" json:"ranks"` // 排行数据 有序的 注意boss类型 } func (x *VikingRankListResp) Reset() { @@ -371,6 +382,13 @@ func (*VikingRankListResp) Descriptor() ([]byte, []int) { return file_viking_viking_msg_proto_rawDescGZIP(), []int{7} } +func (x *VikingRankListResp) GetRanks() []*DBVikingRank { + if x != nil { + return x.Ranks + } + return nil +} + var File_viking_viking_msg_proto protoreflect.FileDescriptor var file_viking_viking_msg_proto_rawDesc = []byte{ @@ -390,14 +408,18 @@ var file_viking_viking_msg_proto_rawDesc = []byte{ 0x69, 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x42, 0x56, 0x69, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x04, 0x64, 0x61, 0x74, - 0x61, 0x22, 0x0e, 0x0a, 0x0c, 0x56, 0x69, 0x6b, 0x69, 0x6e, 0x67, 0x42, 0x75, 0x79, 0x52, 0x65, - 0x71, 0x22, 0x2e, 0x0a, 0x0d, 0x56, 0x69, 0x6b, 0x69, 0x6e, 0x67, 0x42, 0x75, 0x79, 0x52, 0x65, - 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x09, 0x2e, 0x44, 0x42, 0x56, 0x69, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x04, 0x64, 0x61, 0x74, - 0x61, 0x22, 0x13, 0x0a, 0x11, 0x56, 0x69, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x61, 0x6e, 0x6b, 0x4c, - 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x22, 0x14, 0x0a, 0x12, 0x56, 0x69, 0x6b, 0x69, 0x6e, 0x67, - 0x52, 0x61, 0x6e, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, - 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x22, 0x24, 0x0a, 0x0c, 0x56, 0x69, 0x6b, 0x69, 0x6e, 0x67, 0x42, 0x75, 0x79, 0x52, 0x65, + 0x71, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x2e, 0x0a, 0x0d, 0x56, 0x69, 0x6b, 0x69, 0x6e, + 0x67, 0x42, 0x75, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x42, 0x56, 0x69, 0x6b, 0x69, 0x6e, + 0x67, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x13, 0x0a, 0x11, 0x56, 0x69, 0x6b, 0x69, 0x6e, + 0x67, 0x52, 0x61, 0x6e, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x22, 0x39, 0x0a, 0x12, + 0x56, 0x69, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x61, 0x6e, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x12, 0x23, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x6b, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x56, 0x69, 0x6b, 0x69, 0x6e, 0x67, 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 ( @@ -423,16 +445,18 @@ var file_viking_viking_msg_proto_goTypes = []interface{}{ (*VikingRankListReq)(nil), // 6: VikingRankListReq (*VikingRankListResp)(nil), // 7: VikingRankListResp (*DBViking)(nil), // 8: DBViking + (*DBVikingRank)(nil), // 9: DBVikingRank } var file_viking_viking_msg_proto_depIdxs = []int32{ 8, // 0: VikingGetListResp.data:type_name -> DBViking 8, // 1: VikingChallengeResp.data:type_name -> DBViking 8, // 2: VikingBuyResp.data:type_name -> DBViking - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 9, // 3: VikingRankListResp.ranks:type_name -> DBVikingRank + 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_viking_viking_msg_proto_init() } diff --git a/services/worker/main.go b/services/worker/main.go index b1131ce5c..dbb6289d5 100644 --- a/services/worker/main.go +++ b/services/worker/main.go @@ -20,6 +20,7 @@ import ( "go_dreamfactory/modules/shop" "go_dreamfactory/modules/task" "go_dreamfactory/modules/user" + "go_dreamfactory/modules/viking" "go_dreamfactory/services" "go_dreamfactory/sys/db" @@ -65,6 +66,7 @@ func main() { gourmet.NewModule(), martialhall.NewModule(), rtask.NewModule(), + viking.NewModule(), ) }