diff --git a/modules/arena/api_buy.go b/modules/arena/api_buy.go index 433fd6819..0452616c8 100644 --- a/modules/arena/api_buy.go +++ b/modules/arena/api_buy.go @@ -20,6 +20,7 @@ func (this *apiComp) BuyCheck(session comm.IUserSession, req *pb.ArenaBuyReq) (c ///获取自己的排行榜信息 func (this *apiComp) Buy(session comm.IUserSession, req *pb.ArenaBuyReq) (code pb.ErrorCode, data proto.Message) { var ( + global *cfg.GameGlobalData info *pb.DBArenaUser challenge *cfg.GameArenaBuyChallengeData need []*cfg.Gameatn @@ -32,7 +33,11 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.ArenaBuyReq) (code p code = pb.ErrorCode_CacheReadError return } - + global = this.module.configure.GetGlobalConf() + if info.Ticket+req.BuyNum > global.ArenaTicketMax { + code = pb.ErrorCode_ArenaTicketBuyUp + return + } need = make([]*cfg.Gameatn, 0) for i := int32(0); i < req.BuyNum; i++ { if challenge, err = this.module.configure.GetchallengeData(info.Buynum + i + 1); err != nil { diff --git a/pb/errorcode.pb.go b/pb/errorcode.pb.go index 8b15078fb..f294aae19 100644 --- a/pb/errorcode.pb.go +++ b/pb/errorcode.pb.go @@ -197,6 +197,8 @@ const ( ErrorCode_LibraryLvReward ErrorCode = 2805 // 领奖等级没达到 // Battle ErrorCode_BattleValidationFailed ErrorCode = 2901 //战斗校验失败 + // Arena + ErrorCode_ArenaTicketBuyUp ErrorCode = 3001 // 挑战票据到达上限 ) // Enum value maps for ErrorCode. @@ -358,6 +360,7 @@ var ( 2804: "LibraryReward", 2805: "LibraryLvReward", 2901: "BattleValidationFailed", + 3001: "ArenaTicketBuyUp", } ErrorCode_value = map[string]int32{ "Success": 0, @@ -516,6 +519,7 @@ var ( "LibraryReward": 2804, "LibraryLvReward": 2805, "BattleValidationFailed": 2901, + "ArenaTicketBuyUp": 3001, } ) @@ -550,7 +554,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, 0x96, 0x1b, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, + 0x6f, 0x2a, 0xad, 0x1b, 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, @@ -767,8 +771,10 @@ var file_errorcode_proto_rawDesc = []byte{ 0x77, 0x61, 0x72, 0x64, 0x10, 0xf4, 0x15, 0x12, 0x14, 0x0a, 0x0f, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x4c, 0x76, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x10, 0xf5, 0x15, 0x12, 0x1b, 0x0a, 0x16, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x10, 0xd5, 0x16, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, - 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x10, 0xd5, 0x16, 0x12, 0x15, 0x0a, 0x10, 0x41, 0x72, + 0x65, 0x6e, 0x61, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x42, 0x75, 0x79, 0x55, 0x70, 0x10, 0xb9, + 0x17, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var (