上传价格组代码优化

This commit is contained in:
liwei 2023-07-12 17:24:54 +08:00
parent e182aae1a3
commit 99ee5e4f51

View File

@ -597,7 +597,7 @@ func (this *MCompConfigure) GetPriceGroupCost(pricegroupId int32, purchase int32
return return
} }
for _, v := range this._price[pricegroupId] { for _, v := range this._price[pricegroupId] {
if v.Purchasemin <= purchase && purchase <= v.Purchasemax { if v.Purchasemin <= purchase && (purchase <= v.Purchasemax || v.Purchasemax == -1) {
res = v.Cost res = v.Cost
return return
} }
@ -609,8 +609,12 @@ func (this *MCompConfigure) GetPriceGroupLen(pricegroupId int32) (count int32, e
if _, ok := this._price[pricegroupId]; !ok { if _, ok := this._price[pricegroupId]; !ok {
err = comm.NewNotFoundConfErr("tools", game_price, pricegroupId) err = comm.NewNotFoundConfErr("tools", game_price, pricegroupId)
} }
count = int32(len(this._price[pricegroupId])) count = 0
for _, v := range this._price[pricegroupId] {
if count < v.Purchasemax {
count = v.Purchasemax
}
}
return return
} }