From 96c421265d421c97ed8e725d17c158f38b848250 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 16 Aug 2022 14:44:05 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=86=E5=8F=96=E5=A5=96=E5=8A=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/pagoda/api_getReward.go | 29 ++++ modules/pagoda/comp_configure.go | 22 +++ pb/errorcode.pb.go | 237 ++++++++++++++++--------------- 3 files changed, 174 insertions(+), 114 deletions(-) diff --git a/modules/pagoda/api_getReward.go b/modules/pagoda/api_getReward.go index e2b3ffa55..0bf68c9c8 100644 --- a/modules/pagoda/api_getReward.go +++ b/modules/pagoda/api_getReward.go @@ -22,6 +22,35 @@ func (this *apiComp) GetReward(session comm.IUserSession, req *pb.PagodaGetRewar if code != pb.ErrorCode_Success { return // 参数校验失败直接返回 } + // 获取 奖励信息 + list, err := this.module.modelPagoda.getPagodaList(session.GetUserId()) + if err != nil || list == nil { + code = pb.ErrorCode_DBError + return + } + _cfg := this.module.configure.GetPagodaRewardconfig(req.Id) + if _cfg == nil { + code = pb.ErrorCode_ConfigNoFound + return + } + // 校验是否能领取 + if _cfg.LayerNum >= list.PagodaId { + code = pb.ErrorCode_PagodaConditionErr + return + } + if _, ok := list.Reward[req.GetId()]; ok { // 校验是否重复领取 + code = pb.ErrorCode_PagodaGetRewardErr + return + } + if list.Reward == nil { + list.Reward = make(map[int32]bool, 0) + } + + list.Reward[req.Id] = true + mapData := make(map[string]interface{}, 0) + mapData["reward"] = list.Reward + code = this.module.ModifyPagodaData(session.GetUserId(), mapData) + session.SendMsg(string(this.module.GetType()), PagodaGetRewardResp, &pb.PagodaGetRewardResp{Data: list}) return } diff --git a/modules/pagoda/comp_configure.go b/modules/pagoda/comp_configure.go index dc26b19f5..a045e06cc 100644 --- a/modules/pagoda/comp_configure.go +++ b/modules/pagoda/comp_configure.go @@ -93,3 +93,25 @@ func (this *configureComp) GetPagodaconfig(id int32) (data *cfg.GamepagodaData) } return } + +// 爬塔奖励 +func (this *configureComp) GetPagodaRewardconfig(id int32) (data *cfg.GamepagodaTaskRewardData) { + if v, err := this.GetConfigure(game_pagodataskreward); err == nil { + var ( + configure *cfg.GamepagodaTaskReward + ok bool + ) + if configure, ok = v.(*cfg.GamepagodaTaskReward); !ok { + log.Errorf("%T no is *cfg.Game_pagodaData", v) + return + } + + if data, ok = configure.GetDataMap()[id]; ok { + return + } + } else { + log.Errorf("get game_pagodataskreward conf err:%v", err) + return + } + return +} diff --git a/pb/errorcode.pb.go b/pb/errorcode.pb.go index 3854e5c90..f9d270180 100644 --- a/pb/errorcode.pb.go +++ b/pb/errorcode.pb.go @@ -138,120 +138,124 @@ const ( // mail ErrorCode_MailErr ErrorCode = 1800 // 邮件不存在 // pagoda - ErrorCode_PagodaNotFound ErrorCode = 1900 // 找不到塔数据 - ErrorCode_PagodaLevlErr ErrorCode = 19001 // 挑战关卡数据不匹配 + ErrorCode_PagodaNotFound ErrorCode = 1900 // 找不到塔数据 + ErrorCode_PagodaLevlErr ErrorCode = 1901 // 挑战关卡数据不匹配 + ErrorCode_PagodaGetRewardErr ErrorCode = 1902 // 重复领取 + ErrorCode_PagodaConditionErr ErrorCode = 1903 // 条件不足 ) // Enum value maps for ErrorCode. var ( ErrorCode_name = map[int32]string{ - 0: "Success", - 10: "NoFindService", - 11: "NoFindServiceHandleFunc", - 12: "RpcFuncExecutionError", - 13: "CacheReadError", - 14: "SqlExecutionError", - 15: "ReqParameterError", - 16: "SignError", - 17: "InsufficientPermissions", - 18: "NoLogin", - 19: "UserSessionNobeing", - 20: "StateInvalid", - 21: "DBError", - 22: "SystemError", - 23: "DecodeError", - 24: "TimestampTimeout", - 25: "PbError", - 26: "AgentUidEmpty", - 100: "Exception", - 101: "Unknown", - 102: "ResNoEnough", - 103: "ConfigurationException", - 104: "ConfigNoFound", - 1000: "SecKeyInvalid", - 1001: "SecKey", - 1002: "BindUser", - 1003: "GoldNoEnough", - 1004: "DiamondNoEnough", - 1005: "RoleCreated", - 1006: "UserNickNameExist", - 1007: "VeriCodeNoValid", - 1008: "VeriCodeExpired", - 1009: "UserResetData", - 1010: "UserModiNameCount", - 1011: "UserNickNameEmpty", - 1012: "UserExpandNull", - 1100: "FriendNotSelf", - 1101: "FriendSelfMax", - 1102: "FriendTargetMax", - 1103: "FriendSelfNoData", - 1104: "FriendTargetNoData", - 1105: "FriendYet", - 1106: "FriendApplyYet", - 1107: "FriendSelfBlackYet", - 1108: "FriendTargetBlackYet", - 1109: "FriendApplyError", - 1110: "FriendBlackMax", - 1111: "FriendSearchNameEmpty", - 1112: "FriendZaned", - 1113: "FriendZanreceived", - 1114: "FriendZanSelf", - 1115: "FriendPointLimit", - 1200: "ItemsNoEnough", - 1201: "ItemsNoFoundGird", - 1202: "ItemsGridNumUpper", - 1203: "ItemsGirdAmountUpper", - 1204: "ItemsUseNotSupported", - 1300: "HeroNoExist", - 1301: "HeroNoEnough", - 1302: "HeroMaxLv", - 1303: "HeroInitCreat", - 1304: "HeroColorErr", - 1305: "HeroSkillUpErr", - 1306: "HeroMaxResonate", - 1307: "HeroNoResonate", - 1308: "HeroNotNeedResonate", - 1309: "HeroNoEnergy", - 1310: "HeroCreate", - 1311: "HeroEquipUpdate", - 1312: "HeroMaxAwaken", - 1313: "HeroIsLock", - 1314: "HeroMaxCount", - 1315: "HeroCostTypeErr", - 1316: "HeroStarErr", - 1317: "HeroTypeErr", - 1318: "HeroExpTypeErr", - 1319: "HeroAddMaxExp", - 1320: "HeroStarLvErr", - 1321: "HeroMaxStarLv", - 1322: "DrawCardTypeNotFound", - 1323: "HeroMaxSkillLv", - 1400: "EquipmentOnFoundEquipment", - 1401: "EquipmentLvlimitReached", - 1402: "EquipmentIsWorn", - 1500: "MainlineNotFindChapter", - 1501: "MainlineIDFailed", - 1502: "MainlineNotFound", - 1503: "MainlinePreNotFound", - 1504: "MainlineRepeatReward", - 1505: "MainlineCompleteReward", - 1600: "TaskInit", - 1601: "TaskReset", - 1602: "TaskHandle", - 1603: "TaskReceived", - 1604: "TaskActiveInit", - 1605: "TaskActiveNofound", - 1606: "TaskActiveNoenough", - 1607: "TaskNoFinished", - 1608: "TaskFinished", - 1609: "TaskTagEmpty", - 1610: "TaskIdEmpty", - 1611: "TaskNotFound", - 1700: "ShopGoodsIsSoldOut", - 1701: "ShopNoSurplusRefreshNum", - 1800: "MailErr", - 1900: "PagodaNotFound", - 19001: "PagodaLevlErr", + 0: "Success", + 10: "NoFindService", + 11: "NoFindServiceHandleFunc", + 12: "RpcFuncExecutionError", + 13: "CacheReadError", + 14: "SqlExecutionError", + 15: "ReqParameterError", + 16: "SignError", + 17: "InsufficientPermissions", + 18: "NoLogin", + 19: "UserSessionNobeing", + 20: "StateInvalid", + 21: "DBError", + 22: "SystemError", + 23: "DecodeError", + 24: "TimestampTimeout", + 25: "PbError", + 26: "AgentUidEmpty", + 100: "Exception", + 101: "Unknown", + 102: "ResNoEnough", + 103: "ConfigurationException", + 104: "ConfigNoFound", + 1000: "SecKeyInvalid", + 1001: "SecKey", + 1002: "BindUser", + 1003: "GoldNoEnough", + 1004: "DiamondNoEnough", + 1005: "RoleCreated", + 1006: "UserNickNameExist", + 1007: "VeriCodeNoValid", + 1008: "VeriCodeExpired", + 1009: "UserResetData", + 1010: "UserModiNameCount", + 1011: "UserNickNameEmpty", + 1012: "UserExpandNull", + 1100: "FriendNotSelf", + 1101: "FriendSelfMax", + 1102: "FriendTargetMax", + 1103: "FriendSelfNoData", + 1104: "FriendTargetNoData", + 1105: "FriendYet", + 1106: "FriendApplyYet", + 1107: "FriendSelfBlackYet", + 1108: "FriendTargetBlackYet", + 1109: "FriendApplyError", + 1110: "FriendBlackMax", + 1111: "FriendSearchNameEmpty", + 1112: "FriendZaned", + 1113: "FriendZanreceived", + 1114: "FriendZanSelf", + 1115: "FriendPointLimit", + 1200: "ItemsNoEnough", + 1201: "ItemsNoFoundGird", + 1202: "ItemsGridNumUpper", + 1203: "ItemsGirdAmountUpper", + 1204: "ItemsUseNotSupported", + 1300: "HeroNoExist", + 1301: "HeroNoEnough", + 1302: "HeroMaxLv", + 1303: "HeroInitCreat", + 1304: "HeroColorErr", + 1305: "HeroSkillUpErr", + 1306: "HeroMaxResonate", + 1307: "HeroNoResonate", + 1308: "HeroNotNeedResonate", + 1309: "HeroNoEnergy", + 1310: "HeroCreate", + 1311: "HeroEquipUpdate", + 1312: "HeroMaxAwaken", + 1313: "HeroIsLock", + 1314: "HeroMaxCount", + 1315: "HeroCostTypeErr", + 1316: "HeroStarErr", + 1317: "HeroTypeErr", + 1318: "HeroExpTypeErr", + 1319: "HeroAddMaxExp", + 1320: "HeroStarLvErr", + 1321: "HeroMaxStarLv", + 1322: "DrawCardTypeNotFound", + 1323: "HeroMaxSkillLv", + 1400: "EquipmentOnFoundEquipment", + 1401: "EquipmentLvlimitReached", + 1402: "EquipmentIsWorn", + 1500: "MainlineNotFindChapter", + 1501: "MainlineIDFailed", + 1502: "MainlineNotFound", + 1503: "MainlinePreNotFound", + 1504: "MainlineRepeatReward", + 1505: "MainlineCompleteReward", + 1600: "TaskInit", + 1601: "TaskReset", + 1602: "TaskHandle", + 1603: "TaskReceived", + 1604: "TaskActiveInit", + 1605: "TaskActiveNofound", + 1606: "TaskActiveNoenough", + 1607: "TaskNoFinished", + 1608: "TaskFinished", + 1609: "TaskTagEmpty", + 1610: "TaskIdEmpty", + 1611: "TaskNotFound", + 1700: "ShopGoodsIsSoldOut", + 1701: "ShopNoSurplusRefreshNum", + 1800: "MailErr", + 1900: "PagodaNotFound", + 1901: "PagodaLevlErr", + 1902: "PagodaGetRewardErr", + 1903: "PagodaConditionErr", } ErrorCode_value = map[string]int32{ "Success": 0, @@ -360,7 +364,9 @@ var ( "ShopNoSurplusRefreshNum": 1701, "MailErr": 1800, "PagodaNotFound": 1900, - "PagodaLevlErr": 19001, + "PagodaLevlErr": 1901, + "PagodaGetRewardErr": 1902, + "PagodaConditionErr": 1903, } ) @@ -395,7 +401,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, 0xda, 0x11, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, + 0x6f, 0x2a, 0x8b, 0x12, 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, @@ -535,9 +541,12 @@ var file_errorcode_proto_rawDesc = []byte{ 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, 0x13, 0x0a, 0x0d, 0x50, 0x61, 0x67, - 0x6f, 0x64, 0x61, 0x4c, 0x65, 0x76, 0x6c, 0x45, 0x72, 0x72, 0x10, 0xb9, 0x94, 0x01, 0x42, 0x06, - 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 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, 0x42, + 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var (