清理赛季塔数据

This commit is contained in:
meixiongfeng 2022-10-17 19:52:41 +08:00
parent 9a78cbbacf
commit f3c8c8f52c
4 changed files with 228 additions and 29 deletions

View File

@ -38,7 +38,13 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.PagodaGetListReq
} else {
season, _ := this.module.modelSeasonPagoda.getSeasonPagodaList(session.GetUserId())
if season == nil { // 创建一条新的数据
seasonPagoda := &pb.DBSeasonPagoda{}
seasonPagoda.Id = primitive.NewObjectID().Hex()
seasonPagoda.Uid = session.GetUserId()
seasonPagoda.PagodaId = 0 // 初始数据0层
seasonPagoda.Type = 201 // TODO 新的塔数据根据配置文件获取
this.module.modelSeasonPagoda.addNewSeasonPagoda(session.GetUserId(), seasonPagoda)
} else {
list.PagodaId = season.PagodaId
list.Type = season.Type

View File

@ -93,3 +93,28 @@ func (this *configureComp) GetPagodaRewardconfig(id int32) (data *cfg.GamePagoda
}
return
}
// 获取某类型塔层数
func (this *configureComp) GetPagodaFloor(PagodaType int32) int32 {
var maxFloor int32
if v, err := this.GetConfigure(game_pagoda); err == nil {
var (
configure *cfg.GamePagoda
ok bool
)
if configure, ok = v.(*cfg.GamePagoda); !ok {
log.Errorf("%T no is *cfg.Game_pagodaData", v)
return 0
}
for _, value := range configure.GetDataList() {
if value.PagodaType == PagodaType {
maxFloor++
}
}
} else {
log.Errorf("get game_pagodataskreward conf err:%v", err)
return 0
}
return maxFloor
}

View File

@ -1,8 +1,10 @@
package pagoda
import (
"fmt"
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
)
@ -92,3 +94,17 @@ func (this *Pagoda) CheckUserBasePagodaInfo(uid string) (data *pb.DBPagodaRecord
}
return
}
// 清除赛季塔信息
func (this *Pagoda) CleanSeasonPagodaData() (code pb.ErrorCode) {
seasonMaxCount := this.modelPagoda.module.configure.GetPagodaFloor(201)
for iPos := 0; iPos < int(seasonMaxCount); iPos++ {
key := fmt.Sprintf("%s-%d-rank", floorRankKey, iPos+1)
if err := this.modelSeasonPagoda.Redis.Ltrim(key, 0, -1); err != nil {
log.Errorf("delete failed")
}
}
return
}

View File

@ -1788,6 +1788,118 @@ func (*HeroFusionResp) Descriptor() ([]byte, []int) {
return file_hero_hero_msg_proto_rawDescGZIP(), []int{33}
}
// 升星精灵升级
type HeroSpriteStarReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
HeroObjID string `protobuf:"bytes,1,opt,name=heroObjID,proto3" json:"heroObjID"` // 英雄对象ID
Hero []*CostCardData `protobuf:"bytes,2,rep,name=hero,proto3" json:"hero"` // 消耗卡牌对象ID
HeroRace []*CostCardData `protobuf:"bytes,3,rep,name=heroRace,proto3" json:"heroRace"` // 消耗种族卡牌对象ID
}
func (x *HeroSpriteStarReq) Reset() {
*x = HeroSpriteStarReq{}
if protoimpl.UnsafeEnabled {
mi := &file_hero_hero_msg_proto_msgTypes[34]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *HeroSpriteStarReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*HeroSpriteStarReq) ProtoMessage() {}
func (x *HeroSpriteStarReq) ProtoReflect() protoreflect.Message {
mi := &file_hero_hero_msg_proto_msgTypes[34]
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 HeroSpriteStarReq.ProtoReflect.Descriptor instead.
func (*HeroSpriteStarReq) Descriptor() ([]byte, []int) {
return file_hero_hero_msg_proto_rawDescGZIP(), []int{34}
}
func (x *HeroSpriteStarReq) GetHeroObjID() string {
if x != nil {
return x.HeroObjID
}
return ""
}
func (x *HeroSpriteStarReq) GetHero() []*CostCardData {
if x != nil {
return x.Hero
}
return nil
}
func (x *HeroSpriteStarReq) GetHeroRace() []*CostCardData {
if x != nil {
return x.HeroRace
}
return nil
}
// 卡牌升星返回
type HeroSpriteStarResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Hero *DBHero `protobuf:"bytes,1,opt,name=hero,proto3" json:"hero"` // 英雄对象
}
func (x *HeroSpriteStarResp) Reset() {
*x = HeroSpriteStarResp{}
if protoimpl.UnsafeEnabled {
mi := &file_hero_hero_msg_proto_msgTypes[35]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *HeroSpriteStarResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*HeroSpriteStarResp) ProtoMessage() {}
func (x *HeroSpriteStarResp) ProtoReflect() protoreflect.Message {
mi := &file_hero_hero_msg_proto_msgTypes[35]
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 HeroSpriteStarResp.ProtoReflect.Descriptor instead.
func (*HeroSpriteStarResp) Descriptor() ([]byte, []int) {
return file_hero_hero_msg_proto_rawDescGZIP(), []int{35}
}
func (x *HeroSpriteStarResp) GetHero() *DBHero {
if x != nil {
return x.Hero
}
return nil
}
var File_hero_hero_msg_proto protoreflect.FileDescriptor
var file_hero_hero_msg_proto_rawDesc = []byte{
@ -1949,8 +2061,19 @@ var file_hero_hero_msg_proto_rawDesc = []byte{
0x09, 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, 0x10, 0x0a, 0x0e, 0x48, 0x65, 0x72, 0x6f, 0x46, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65,
0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x33,
0x73, 0x70, 0x22, 0x7f, 0x0a, 0x11, 0x48, 0x65, 0x72, 0x6f, 0x53, 0x70, 0x72, 0x69, 0x74, 0x65,
0x53, 0x74, 0x61, 0x72, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f,
0x62, 0x6a, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x68, 0x65, 0x72, 0x6f,
0x4f, 0x62, 0x6a, 0x49, 0x44, 0x12, 0x21, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x02, 0x20,
0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x43, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x72, 0x64, 0x44, 0x61,
0x74, 0x61, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x12, 0x29, 0x0a, 0x08, 0x68, 0x65, 0x72, 0x6f,
0x52, 0x61, 0x63, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x43, 0x6f, 0x73,
0x74, 0x43, 0x61, 0x72, 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x08, 0x68, 0x65, 0x72, 0x6f, 0x52,
0x61, 0x63, 0x65, 0x22, 0x31, 0x0a, 0x12, 0x48, 0x65, 0x72, 0x6f, 0x53, 0x70, 0x72, 0x69, 0x74,
0x65, 0x53, 0x74, 0x61, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1b, 0x0a, 0x04, 0x68, 0x65, 0x72,
0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f,
0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -1965,7 +2088,7 @@ func file_hero_hero_msg_proto_rawDescGZIP() []byte {
return file_hero_hero_msg_proto_rawDescData
}
var file_hero_hero_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 37)
var file_hero_hero_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 39)
var file_hero_hero_msg_proto_goTypes = []interface{}{
(*HeroInfoReq)(nil), // 0: HeroInfoReq
(*HeroInfoResp)(nil), // 1: HeroInfoResp
@ -2001,37 +2124,42 @@ var file_hero_hero_msg_proto_goTypes = []interface{}{
(*HeroDrawCardFloorResp)(nil), // 31: HeroDrawCardFloorResp
(*HeroFusionReq)(nil), // 32: HeroFusionReq
(*HeroFusionResp)(nil), // 33: HeroFusionResp
nil, // 34: HeroPropertyPush.PropertyEntry
nil, // 35: HeroPropertyPush.AddPropertyEntry
nil, // 36: HeroFusionReq.HerosEntry
(*DBHero)(nil), // 37: DBHero
(*HeroSpriteStarReq)(nil), // 34: HeroSpriteStarReq
(*HeroSpriteStarResp)(nil), // 35: HeroSpriteStarResp
nil, // 36: HeroPropertyPush.PropertyEntry
nil, // 37: HeroPropertyPush.AddPropertyEntry
nil, // 38: HeroFusionReq.HerosEntry
(*DBHero)(nil), // 39: DBHero
}
var file_hero_hero_msg_proto_depIdxs = []int32{
37, // 0: HeroInfoResp.base:type_name -> DBHero
37, // 1: HeroListResp.list:type_name -> DBHero
39, // 0: HeroInfoResp.base:type_name -> DBHero
39, // 1: HeroListResp.list:type_name -> DBHero
5, // 2: HeroStrengthenUplvReq.expCards:type_name -> MapStringInt32
37, // 3: HeroStrengthenUplvResp.hero:type_name -> DBHero
39, // 3: HeroStrengthenUplvResp.hero:type_name -> DBHero
8, // 4: HeroStrengthenUpStarReq.hero:type_name -> CostCardData
8, // 5: HeroStrengthenUpStarReq.heroRace:type_name -> CostCardData
37, // 6: HeroStrengthenUpStarResp.hero:type_name -> DBHero
37, // 7: HeroStrengthenUpSkillResp.hero:type_name -> DBHero
37, // 8: HeroResonanceResp.hero:type_name -> DBHero
37, // 9: HeroResonanceResp.upStarCard:type_name -> DBHero
37, // 10: HeroResonanceResetResp.hero:type_name -> DBHero
39, // 6: HeroStrengthenUpStarResp.hero:type_name -> DBHero
39, // 7: HeroStrengthenUpSkillResp.hero:type_name -> DBHero
39, // 8: HeroResonanceResp.hero:type_name -> DBHero
39, // 9: HeroResonanceResp.upStarCard:type_name -> DBHero
39, // 10: HeroResonanceResetResp.hero:type_name -> DBHero
17, // 11: HeroResonanceUseEnergyReq.energy:type_name -> EnergyData
37, // 12: HeroResonanceUseEnergyResp.hero:type_name -> DBHero
37, // 13: HeroAwakenResp.hero:type_name -> DBHero
34, // 14: HeroPropertyPush.property:type_name -> HeroPropertyPush.PropertyEntry
35, // 15: HeroPropertyPush.addProperty:type_name -> HeroPropertyPush.AddPropertyEntry
37, // 16: HeroLockResp.hero:type_name -> DBHero
37, // 17: HeroGetSpecifiedResp.hero:type_name -> DBHero
37, // 18: HeroChangePush.list:type_name -> DBHero
36, // 19: HeroFusionReq.heros:type_name -> HeroFusionReq.HerosEntry
20, // [20:20] is the sub-list for method output_type
20, // [20:20] is the sub-list for method input_type
20, // [20:20] is the sub-list for extension type_name
20, // [20:20] is the sub-list for extension extendee
0, // [0:20] is the sub-list for field type_name
39, // 12: HeroResonanceUseEnergyResp.hero:type_name -> DBHero
39, // 13: HeroAwakenResp.hero:type_name -> DBHero
36, // 14: HeroPropertyPush.property:type_name -> HeroPropertyPush.PropertyEntry
37, // 15: HeroPropertyPush.addProperty:type_name -> HeroPropertyPush.AddPropertyEntry
39, // 16: HeroLockResp.hero:type_name -> DBHero
39, // 17: HeroGetSpecifiedResp.hero:type_name -> DBHero
39, // 18: HeroChangePush.list:type_name -> DBHero
38, // 19: HeroFusionReq.heros:type_name -> HeroFusionReq.HerosEntry
8, // 20: HeroSpriteStarReq.hero:type_name -> CostCardData
8, // 21: HeroSpriteStarReq.heroRace:type_name -> CostCardData
39, // 22: HeroSpriteStarResp.hero:type_name -> DBHero
23, // [23:23] is the sub-list for method output_type
23, // [23:23] is the sub-list for method input_type
23, // [23:23] is the sub-list for extension type_name
23, // [23:23] is the sub-list for extension extendee
0, // [0:23] is the sub-list for field type_name
}
func init() { file_hero_hero_msg_proto_init() }
@ -2449,6 +2577,30 @@ func file_hero_hero_msg_proto_init() {
return nil
}
}
file_hero_hero_msg_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*HeroSpriteStarReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_hero_hero_msg_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*HeroSpriteStarResp); 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{
@ -2456,7 +2608,7 @@ func file_hero_hero_msg_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_hero_hero_msg_proto_rawDesc,
NumEnums: 0,
NumMessages: 37,
NumMessages: 39,
NumExtensions: 0,
NumServices: 0,
},