远征购买挑战失败
This commit is contained in:
parent
b798c860ad
commit
0618111487
@ -26,6 +26,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HuntingBuyReq) (code
|
|||||||
mapData map[string]interface{}
|
mapData map[string]interface{}
|
||||||
szCostRes []*cfg.Gameatn // 购买累计消耗
|
szCostRes []*cfg.Gameatn // 购买累计消耗
|
||||||
curCount int32 // 当前门票数量
|
curCount int32 // 当前门票数量
|
||||||
|
addCount int32 //获得数量
|
||||||
)
|
)
|
||||||
mapData = make(map[string]interface{}, 0)
|
mapData = make(map[string]interface{}, 0)
|
||||||
code = this.BuyCheck(session, req)
|
code = this.BuyCheck(session, req)
|
||||||
@ -81,18 +82,16 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HuntingBuyReq) (code
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if curCount-amount > 0 {
|
if curCount-amount > 0 {
|
||||||
res := &cfg.Gameatn{
|
addCount = curCount - amount
|
||||||
A: "item",
|
|
||||||
T: costRes.T,
|
|
||||||
N: curCount - amount,
|
|
||||||
}
|
|
||||||
if code = this.module.DispenseRes(session, []*cfg.Gameatn{res}, true); code != pb.ErrorCode_Success {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
list.RecoveryTime = 0
|
list.RecoveryTime = 0
|
||||||
}
|
}
|
||||||
|
addCount += req.Count
|
||||||
|
if amount+addCount > conf.VikingNum {
|
||||||
|
code = pb.ErrorCode_VikingBuyMaxCount
|
||||||
|
return
|
||||||
|
}
|
||||||
mapData["recoveryTime"] = list.RecoveryTime
|
mapData["recoveryTime"] = list.RecoveryTime
|
||||||
|
|
||||||
for i := list.BuyCount + 1; i <= curByCount; i++ {
|
for i := list.BuyCount + 1; i <= curByCount; i++ {
|
||||||
@ -121,6 +120,14 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HuntingBuyReq) (code
|
|||||||
if code = this.module.ConsumeRes(session, sz, true); code != pb.ErrorCode_Success {
|
if code = this.module.ConsumeRes(session, sz, true); code != pb.ErrorCode_Success {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
res := &cfg.Gameatn{
|
||||||
|
A: "item",
|
||||||
|
T: costRes.T,
|
||||||
|
N: addCount,
|
||||||
|
}
|
||||||
|
if code = this.module.DispenseRes(session, []*cfg.Gameatn{res}, true); code != pb.ErrorCode_Success {
|
||||||
|
return
|
||||||
|
}
|
||||||
list.BuyCount = curByCount
|
list.BuyCount = curByCount
|
||||||
mapData["buyCount"] = curByCount
|
mapData["buyCount"] = curByCount
|
||||||
code = this.module.ModifyHuntingData(session.GetUserId(), mapData)
|
code = this.module.ModifyHuntingData(session.GetUserId(), mapData)
|
||||||
|
@ -26,6 +26,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.VikingBuyReq) (code
|
|||||||
mapData map[string]interface{}
|
mapData map[string]interface{}
|
||||||
curCount int32 // 当前门票数量
|
curCount int32 // 当前门票数量
|
||||||
szcostRes []*cfg.Gameatn // 购买累计消耗
|
szcostRes []*cfg.Gameatn // 购买累计消耗
|
||||||
|
addCount int32 //获得数量
|
||||||
)
|
)
|
||||||
mapData = make(map[string]interface{}, 0)
|
mapData = make(map[string]interface{}, 0)
|
||||||
code = this.BuyCheck(session, req)
|
code = this.BuyCheck(session, req)
|
||||||
@ -77,18 +78,17 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.VikingBuyReq) (code
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if curCount-amount > 0 {
|
if curCount-amount > 0 {
|
||||||
res := &cfg.Gameatn{
|
addCount = curCount - amount
|
||||||
A: "item",
|
|
||||||
T: costRes.T,
|
|
||||||
N: curCount - amount,
|
|
||||||
}
|
|
||||||
if code = this.module.DispenseRes(session, []*cfg.Gameatn{res}, true); code != pb.ErrorCode_Success {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
list.RecoveryTime = 0
|
list.RecoveryTime = 0
|
||||||
}
|
}
|
||||||
|
addCount += req.Count
|
||||||
|
if amount+addCount > conf.VikingNum {
|
||||||
|
code = pb.ErrorCode_VikingBuyMaxCount
|
||||||
|
return
|
||||||
|
}
|
||||||
mapData["recoveryTime"] = list.RecoveryTime // 更新刷新时间
|
mapData["recoveryTime"] = list.RecoveryTime // 更新刷新时间
|
||||||
curByCount += req.Count // 当前需要购买的数量
|
curByCount += req.Count // 当前需要购买的数量
|
||||||
|
|
||||||
@ -123,6 +123,14 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.VikingBuyReq) (code
|
|||||||
if code = this.module.ConsumeRes(session, sz, true); code != pb.ErrorCode_Success {
|
if code = this.module.ConsumeRes(session, sz, true); code != pb.ErrorCode_Success {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
res := &cfg.Gameatn{
|
||||||
|
A: "item",
|
||||||
|
T: costRes.T,
|
||||||
|
N: addCount,
|
||||||
|
}
|
||||||
|
if code = this.module.DispenseRes(session, []*cfg.Gameatn{res}, true); code != pb.ErrorCode_Success {
|
||||||
|
return
|
||||||
|
}
|
||||||
list.BuyCount = curByCount
|
list.BuyCount = curByCount
|
||||||
mapData["buyCount"] = curByCount
|
mapData["buyCount"] = curByCount
|
||||||
code = this.module.ModifyVikingData(session.GetUserId(), mapData)
|
code = this.module.ModifyVikingData(session.GetUserId(), mapData)
|
||||||
|
Loading…
Reference in New Issue
Block a user