From dcbc9b5490df91690ccc4096f4b5eeffa20dcf4a Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Wed, 21 Dec 2022 20:08:56 +0800 Subject: [PATCH] =?UTF-8?q?vip=20=E7=89=B9=E6=9D=83=20=E9=A2=9D=E5=A4=96?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=B4=AD=E4=B9=B0=E6=AC=A1=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/const.go | 20 ++++++++++---------- modules/hunting/api_buy.go | 21 ++++++++++++--------- modules/hunting/comp_configure.go | 14 ++++++++++++++ 3 files changed, 36 insertions(+), 19 deletions(-) diff --git a/comm/const.go b/comm/const.go index 471e5822c..16072e859 100644 --- a/comm/const.go +++ b/comm/const.go @@ -653,14 +653,14 @@ const ( // 特权类型 const ( - PrivilegeType1 = iota + 1 //每日获得 - PrivilegeType2 //金币商店每日免费刷新次数 - PrivilegeType3 //维京远征每日可购买挑战次数 - PrivilegeType4 //狩猎每日可购买挑战次数 - PrivilegeType5 //竞技场每日可购买挑战次数 - PrivilegeType6 //梦境每日可购买挑战次数 - PrivilegeType7 //巨怪商队背包容量 - PrivilegeType8 //美食馆每日最大制作时间 - PrivilegeType9 //武馆每日最大练功时间 - PrivilegeType10 //铁匠铺每日最大锻造时间 + PrivilegeType1 int32 = iota + 1 //每日获得 + PrivilegeType2 //金币商店每日免费刷新次数 + PrivilegeType3 //维京远征每日可购买挑战次数 + PrivilegeType4 //狩猎每日可购买挑战次数 + PrivilegeType5 //竞技场每日可购买挑战次数 + PrivilegeType6 //梦境每日可购买挑战次数 + PrivilegeType7 //巨怪商队背包容量 + PrivilegeType8 //美食馆每日最大制作时间 + PrivilegeType9 //武馆每日最大练功时间 + PrivilegeType10 //铁匠铺每日最大锻造时间 ) diff --git a/modules/hunting/api_buy.go b/modules/hunting/api_buy.go index f1ec5e14e..0951c91e9 100644 --- a/modules/hunting/api_buy.go +++ b/modules/hunting/api_buy.go @@ -21,12 +21,13 @@ func (this *apiComp) BuyCheck(session comm.IUserSession, req *pb.HuntingBuyReq) func (this *apiComp) Buy(session comm.IUserSession, req *pb.HuntingBuyReq) (code pb.ErrorCode, data proto.Message) { var ( - curByCount int32 - costRes *cfg.Gameatn // 门票atn 类型 只取T - mapData map[string]interface{} - szCostRes []*cfg.Gameatn // 购买累计消耗 - curCount int32 // 当前门票数量 - addCount int32 //获得数量 + curByCount int32 + costRes *cfg.Gameatn // 门票atn 类型 只取T + mapData map[string]interface{} + szCostRes []*cfg.Gameatn // 购买累计消耗 + curCount int32 // 当前门票数量 + addCount int32 //获得数量 + PrivilegeBuyCount int32 // 特权购买次数 ) mapData = make(map[string]interface{}, 0) code = this.BuyCheck(session, req) @@ -48,8 +49,10 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HuntingBuyReq) (code } else { curByCount = list.BuyCount } + + PrivilegeBuyCount = this.module.ModulePrivilege.GetCountByPrivilegeId(session.GetUserId(), comm.PrivilegeType4) curByCount += req.Count // 当前需要购买的数量 - if this.configure.GetMaxBuyChallengeCount() < curByCount { + if this.configure.GetMaxBuyChallengeCount()+PrivilegeBuyCount < curByCount { code = pb.ErrorCode_HuntingBuyMaxCount return } @@ -97,8 +100,8 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HuntingBuyReq) (code for i := list.BuyCount + 1; i <= curByCount; i++ { _cfg := this.configure.GetBuyChallengeCount(i) if _cfg == nil { - code = pb.ErrorCode_HuntingBuyMaxCount - return + // 取最后一条 + _cfg = this.configure.GetLastBuyChallenge() } szCostRes = append(szCostRes, _cfg.Need...) } diff --git a/modules/hunting/comp_configure.go b/modules/hunting/comp_configure.go index 052b03479..b389266d8 100644 --- a/modules/hunting/comp_configure.go +++ b/modules/hunting/comp_configure.go @@ -110,3 +110,17 @@ func (this *configureComp) GetMaxBuyChallengeCount() int32 { return 0 } + +// 获取最后一条数据 +func (this *configureComp) GetLastBuyChallenge() (data *cfg.GameHuntingChallengeData) { + if v, err := this.GetConfigure(game_challenge); err == nil { + if configure, ok := v.(*cfg.GameHuntingChallenge); ok && len(configure.GetDataList()) > 0 { + data = configure.GetDataList()[len(configure.GetDataList())-1] + return + } + } else { + log.Errorf("get game_challenge conf err:%v", err) + } + + return +}