上传竞技场异常修复

This commit is contained in:
liwei1dao 2023-11-20 18:02:17 +08:00
parent ba09658fda
commit 482d16046a
5 changed files with 68 additions and 59 deletions

View File

@ -59,7 +59,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.ArenaChallenge
})
if red.Attack != nil {
for i, v := range req.Battle.Format {
if red.Attack.Formt[i].Id != v {
if (red.Attack.Formt[i] != nil && red.Attack.Formt[i].Id != v) || (red.Attack.Formt[i] == nil && v == "") {
change = true
}
}
@ -78,7 +78,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.ArenaChallenge
}
ok = false
for _, v := range heros {
if v.Id != "" {
if v != nil && v.Id != "" {
ok = true
}
}

View File

@ -98,7 +98,7 @@ func (this *modelArena) queryUserHeros(uid string, heroids []string) (results []
return
}
for _, v := range heroids {
if v == "" {
if v != "" {
ids = append(ids, v)
}
}

View File

@ -22,6 +22,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.IsLandBuyReq) (errda
info *pb.DBIsland
heros []*pb.DBHero
hero *pb.DBHero
buynum int32
ok bool
err error
)
@ -57,7 +58,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.IsLandBuyReq) (errda
return
}
if _, ok = info.Heroshop[req.Cids]; ok {
if buynum, ok = info.Heroshop[req.Cids]; ok && buynum > 0 {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ReqParameterError,
Message: "Purchased !",
@ -112,6 +113,6 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.IsLandBuyReq) (errda
this.module.model.Change(session.GetUserId(), map[string]interface{}{
"heroshop": info.Heroshop,
})
session.SendMsg(string(this.module.GetType()), "info", &pb.IsLandInfoResp{Info: info, Heros: heros})
session.SendMsg(string(this.module.GetType()), "buy", &pb.IsLandBuyResp{Hero: hero})
return
}

View File

@ -6,19 +6,19 @@ import (
)
// 参数校验
func (this *apiComp) RefreshHeroShopCheck(session comm.IUserSession, req *pb.IsLandRefresHeroShopReq) (errdata *pb.ErrorData) {
func (this *apiComp) RefresHeroShopCheck(session comm.IUserSession, req *pb.IsLandRefresHeroShopReq) (errdata *pb.ErrorData) {
return
}
//刷新商店
func (this *apiComp) RefreshHeroShop(session comm.IUserSession, req *pb.IsLandRefresHeroShopReq) (errdata *pb.ErrorData) {
func (this *apiComp) RefresHeroShop(session comm.IUserSession, req *pb.IsLandRefresHeroShopReq) (errdata *pb.ErrorData) {
var (
info *pb.DBIsland
cards []string
err error
)
if errdata = this.RefreshHeroShopCheck(session, req); errdata != nil {
if errdata = this.RefresHeroShopCheck(session, req); errdata != nil {
return
}
@ -45,6 +45,6 @@ func (this *apiComp) RefreshHeroShop(session comm.IUserSession, req *pb.IsLandRe
"heroshop": info.Heroshop,
"refreshed": info.Refreshed,
})
session.SendMsg(string(this.module.GetType()), "info", &pb.IsLandRefresHeroShopResp{Refreshed: info.Refreshed, Heroshop: cards})
session.SendMsg(string(this.module.GetType()), "refresheroshop", &pb.IsLandRefresHeroShopResp{Refreshed: info.Refreshed, Heroshop: info.Heroshop})
return
}

View File

@ -406,8 +406,8 @@ type IsLandRefresHeroShopResp struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Refreshed int32 `protobuf:"varint,1,opt,name=refreshed,proto3" json:"refreshed"` //已刷新
Heroshop []string `protobuf:"bytes,2,rep,name=heroshop,proto3" json:"heroshop"` //英雄商店
Refreshed int32 `protobuf:"varint,1,opt,name=refreshed,proto3" json:"refreshed"` //已刷新
Heroshop map[string]int32 `protobuf:"bytes,2,rep,name=heroshop,proto3" json:"heroshop" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //英雄商店
}
func (x *IsLandRefresHeroShopResp) Reset() {
@ -449,7 +449,7 @@ func (x *IsLandRefresHeroShopResp) GetRefreshed() int32 {
return 0
}
func (x *IsLandRefresHeroShopResp) GetHeroshop() []string {
func (x *IsLandRefresHeroShopResp) GetHeroshop() map[string]int32 {
if x != nil {
return x.Heroshop
}
@ -791,31 +791,37 @@ var file_island_island_msg_proto_rawDesc = []byte{
0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x55,
0x73, 0x65, 0x72, 0x41, 0x74, 0x6e, 0x6f, 0x52, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x22, 0x19,
0x0a, 0x17, 0x49, 0x73, 0x4c, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x48, 0x65,
0x72, 0x6f, 0x53, 0x68, 0x6f, 0x70, 0x52, 0x65, 0x71, 0x22, 0x54, 0x0a, 0x18, 0x49, 0x73, 0x4c,
0x61, 0x6e, 0x64, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x48, 0x65, 0x72, 0x6f, 0x53, 0x68, 0x6f,
0x70, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68,
0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73,
0x68, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x68, 0x65, 0x72, 0x6f, 0x73, 0x68, 0x6f, 0x70, 0x18,
0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x68, 0x65, 0x72, 0x6f, 0x73, 0x68, 0x6f, 0x70, 0x22,
0x22, 0x0a, 0x0c, 0x49, 0x73, 0x4c, 0x61, 0x6e, 0x64, 0x42, 0x75, 0x79, 0x52, 0x65, 0x71, 0x12,
0x12, 0x0a, 0x04, 0x63, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63,
0x69, 0x64, 0x73, 0x22, 0x2c, 0x0a, 0x0d, 0x49, 0x73, 0x4c, 0x61, 0x6e, 0x64, 0x42, 0x75, 0x79,
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, 0x22, 0x24, 0x0a, 0x10, 0x49, 0x73, 0x4c, 0x61, 0x6e, 0x64, 0x55, 0x70, 0x67, 0x72, 0x61,
0x64, 0x65, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x05, 0x52, 0x03, 0x6e, 0x69, 0x64, 0x22, 0x35, 0x0a, 0x11, 0x49, 0x73, 0x4c, 0x61, 0x6e,
0x64, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03,
0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6e, 0x69, 0x64, 0x12, 0x0e,
0x0a, 0x02, 0x6c, 0x76, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x22, 0x12,
0x0a, 0x10, 0x49, 0x73, 0x4c, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52,
0x65, 0x71, 0x22, 0x53, 0x0a, 0x11, 0x49, 0x73, 0x4c, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x63, 0x65,
0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18,
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x42, 0x49, 0x73, 0x6c, 0x61, 0x6e, 0x64,
0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 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,
0x72, 0x6f, 0x53, 0x68, 0x6f, 0x70, 0x52, 0x65, 0x71, 0x22, 0xba, 0x01, 0x0a, 0x18, 0x49, 0x73,
0x4c, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x48, 0x65, 0x72, 0x6f, 0x53, 0x68,
0x6f, 0x70, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73,
0x68, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x72, 0x65, 0x66, 0x72, 0x65,
0x73, 0x68, 0x65, 0x64, 0x12, 0x43, 0x0a, 0x08, 0x68, 0x65, 0x72, 0x6f, 0x73, 0x68, 0x6f, 0x70,
0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x49, 0x73, 0x4c, 0x61, 0x6e, 0x64, 0x52,
0x65, 0x66, 0x72, 0x65, 0x73, 0x48, 0x65, 0x72, 0x6f, 0x53, 0x68, 0x6f, 0x70, 0x52, 0x65, 0x73,
0x70, 0x2e, 0x48, 0x65, 0x72, 0x6f, 0x73, 0x68, 0x6f, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52,
0x08, 0x68, 0x65, 0x72, 0x6f, 0x73, 0x68, 0x6f, 0x70, 0x1a, 0x3b, 0x0a, 0x0d, 0x48, 0x65, 0x72,
0x6f, 0x73, 0x68, 0x6f, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65,
0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 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, 0x22, 0x0a, 0x0c, 0x49, 0x73, 0x4c, 0x61, 0x6e, 0x64,
0x42, 0x75, 0x79, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x69, 0x64, 0x73, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x69, 0x64, 0x73, 0x22, 0x2c, 0x0a, 0x0d, 0x49, 0x73,
0x4c, 0x61, 0x6e, 0x64, 0x42, 0x75, 0x79, 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, 0x22, 0x24, 0x0a, 0x10, 0x49, 0x73, 0x4c, 0x61,
0x6e, 0x64, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03,
0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6e, 0x69, 0x64, 0x22, 0x35,
0x0a, 0x11, 0x49, 0x73, 0x4c, 0x61, 0x6e, 0x64, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52,
0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
0x52, 0x03, 0x6e, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x02, 0x20, 0x01, 0x28,
0x05, 0x52, 0x02, 0x6c, 0x76, 0x22, 0x12, 0x0a, 0x10, 0x49, 0x73, 0x4c, 0x61, 0x6e, 0x64, 0x52,
0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x22, 0x53, 0x0a, 0x11, 0x49, 0x73, 0x4c,
0x61, 0x6e, 0x64, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d,
0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44,
0x42, 0x49, 0x73, 0x6c, 0x61, 0x6e, 0x64, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 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,
}
var (
@ -830,7 +836,7 @@ func file_island_island_msg_proto_rawDescGZIP() []byte {
return file_island_island_msg_proto_rawDescData
}
var file_island_island_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 14)
var file_island_island_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 15)
var file_island_island_msg_proto_goTypes = []interface{}{
(*IsLandInfoReq)(nil), // 0: IsLandInfoReq
(*IsLandInfoResp)(nil), // 1: IsLandInfoResp
@ -846,28 +852,30 @@ var file_island_island_msg_proto_goTypes = []interface{}{
(*IsLandUpgradeResp)(nil), // 11: IsLandUpgradeResp
(*IsLandReceiveReq)(nil), // 12: IsLandReceiveReq
(*IsLandReceiveResp)(nil), // 13: IsLandReceiveResp
(*DBIsland)(nil), // 14: DBIsland
(*DBHero)(nil), // 15: DBHero
(*BattleFormation)(nil), // 16: BattleFormation
(*BattleInfo)(nil), // 17: BattleInfo
(*BattleReport)(nil), // 18: BattleReport
(*UserAtno)(nil), // 19: UserAtno
nil, // 14: IsLandRefresHeroShopResp.HeroshopEntry
(*DBIsland)(nil), // 15: DBIsland
(*DBHero)(nil), // 16: DBHero
(*BattleFormation)(nil), // 17: BattleFormation
(*BattleInfo)(nil), // 18: BattleInfo
(*BattleReport)(nil), // 19: BattleReport
(*UserAtno)(nil), // 20: UserAtno
}
var file_island_island_msg_proto_depIdxs = []int32{
14, // 0: IsLandInfoResp.info:type_name -> DBIsland
15, // 1: IsLandInfoResp.heros:type_name -> DBHero
16, // 2: IsLandBattleReq.battle:type_name -> BattleFormation
17, // 3: IsLandBattleResp.info:type_name -> BattleInfo
18, // 4: IsLandCompleteReq.report:type_name -> BattleReport
19, // 5: IsLandCompleteResp.award:type_name -> UserAtno
15, // 6: IsLandBuyResp.hero:type_name -> DBHero
14, // 7: IsLandReceiveResp.info:type_name -> DBIsland
19, // 8: IsLandReceiveResp.award:type_name -> UserAtno
9, // [9:9] is the sub-list for method output_type
9, // [9:9] is the sub-list for method input_type
9, // [9:9] is the sub-list for extension type_name
9, // [9:9] is the sub-list for extension extendee
0, // [0:9] is the sub-list for field type_name
15, // 0: IsLandInfoResp.info:type_name -> DBIsland
16, // 1: IsLandInfoResp.heros:type_name -> DBHero
17, // 2: IsLandBattleReq.battle:type_name -> BattleFormation
18, // 3: IsLandBattleResp.info:type_name -> BattleInfo
19, // 4: IsLandCompleteReq.report:type_name -> BattleReport
20, // 5: IsLandCompleteResp.award:type_name -> UserAtno
14, // 6: IsLandRefresHeroShopResp.heroshop:type_name -> IsLandRefresHeroShopResp.HeroshopEntry
16, // 7: IsLandBuyResp.hero:type_name -> DBHero
15, // 8: IsLandReceiveResp.info:type_name -> DBIsland
20, // 9: IsLandReceiveResp.award:type_name -> UserAtno
10, // [10:10] is the sub-list for method output_type
10, // [10:10] is the sub-list for method input_type
10, // [10:10] is the sub-list for extension type_name
10, // [10:10] is the sub-list for extension extendee
0, // [0:10] is the sub-list for field type_name
}
func init() { file_island_island_msg_proto_init() }
@ -1055,7 +1063,7 @@ func file_island_island_msg_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_island_island_msg_proto_rawDesc,
NumEnums: 0,
NumMessages: 14,
NumMessages: 15,
NumExtensions: 0,
NumServices: 0,
},