跑商交易次数校验错误bug
This commit is contained in:
parent
be2f72fa63
commit
7d5bfaad21
@ -35,7 +35,7 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.TrollBuyOrSell
|
||||
return
|
||||
}
|
||||
dayMaxCount := this.configure.GetTrollRule(comm.TrollBuyCount)
|
||||
aiMaxCount := this.configure.GetTrollRule(comm.TrollAIBuyCount)
|
||||
//aiMaxCount := this.configure.GetTrollRule(comm.TrollAIBuyCount)
|
||||
for k, v := range req.Items {
|
||||
|
||||
if v == 0 { // 过滤数量为0 的消息
|
||||
@ -49,7 +49,8 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.TrollBuyOrSell
|
||||
if !bSell {
|
||||
bSell = true
|
||||
trolltrain.SellCount += 1 // 交易次数+1
|
||||
if trolltrain.SellCount > aiMaxCount-dayMaxCount {
|
||||
if trolltrain.AiCount+trolltrain.SellCount >= dayMaxCount {
|
||||
//if trolltrain.SellCount > aiMaxCount-trolltrain.AiCount {
|
||||
code = pb.ErrorCode_TrollMaxSellCount // 达到最大交易次数 直接返回
|
||||
return
|
||||
}
|
||||
|
@ -32,9 +32,9 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.TrollGetListReq)
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
dayMaxCount := this.configure.GetTrollRule(comm.TrollBuyCount)
|
||||
aiCount := this.configure.GetTrollRule(comm.TrollAIBuyCount)
|
||||
if trolltrain.AiCount <= aiCount-dayMaxCount { // 小于离线挂机次数可执行
|
||||
dayMaxCount := this.configure.GetTrollRule(comm.TrollBuyCount) // 8
|
||||
aiCount := this.configure.GetTrollRule(comm.TrollAIBuyCount) // 10
|
||||
if trolltrain.AiCount+trolltrain.SellCount < dayMaxCount {
|
||||
this.module.TrollAI(session, trolltrain, aiCount)
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,6 @@ func (this *Troll) TrollAI(session comm.IUserSession, troll *pb.DBTrollTrain, ai
|
||||
sellPrice = make(map[int32]int32)
|
||||
now := time.Now().Unix()
|
||||
trainNum := this.configure.GetTrollMaxTraintNum()
|
||||
dayMaxCount := this.configure.GetTrollRule(comm.TrollBuyCount)
|
||||
maxCoefficient := this.configure.GetTrollMaxCoefficientNux() // 增长幅度的最大值
|
||||
if maxCoefficient == 0 {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
@ -122,8 +121,8 @@ func (this *Troll) TrollAI(session comm.IUserSession, troll *pb.DBTrollTrain, ai
|
||||
this.SeTrollRankList(troll.TotalEarn, session.GetUserId()) // 设置排行数据
|
||||
|
||||
troll.AiCount++
|
||||
|
||||
if troll.AiCount > aiCount-dayMaxCount { //达到最大交易次数
|
||||
aiMaxCount := this.configure.GetTrollRule(comm.TrollAIBuyCount)
|
||||
if troll.AiCount > aiMaxCount { //达到最大交易次数
|
||||
break
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user