From ddde857f8b3498d117ae5c35be5af24702dda587 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 29 Nov 2022 11:15:02 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8B=A9=E7=8C=8E=E8=B4=AD=E4=B9=B0=E6=8C=91?= =?UTF-8?q?=E6=88=98=E5=8D=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/hunting/api_buy.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/hunting/api_buy.go b/modules/hunting/api_buy.go index b3bf915fd..71b9db2a2 100644 --- a/modules/hunting/api_buy.go +++ b/modules/hunting/api_buy.go @@ -47,6 +47,11 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HuntingBuyReq) (code } else { curByCount = list.BuyCount } + curByCount += req.Count // 当前需要购买的数量 + if this.configure.GetMaxBuyChallengeCount() < curByCount { + code = pb.ErrorCode_HuntingBuyMaxCount + return + } conf := this.module.configure.GetGlobalConf() if conf == nil { code = pb.ErrorCode_ConfigNoFound @@ -88,11 +93,6 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HuntingBuyReq) (code list.RecoveryTime = 0 } mapData["recoveryTime"] = list.RecoveryTime - curByCount += req.Count // 当前需要购买的数量 - if this.configure.GetMaxBuyChallengeCount() < curByCount { - code = pb.ErrorCode_HuntingBuyMaxCount - return - } for i := list.BuyCount + 1; i <= curByCount; i++ { _cfg := this.configure.GetBuyChallengeCount(i) @@ -109,6 +109,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HuntingBuyReq) (code if v.A == v1.A && v.T == v1.T { v1.N += v.N bFound = true + break } } if !bFound {