diff --git a/service/cardholder/handle.go b/service/cardholder/handle.go index 9bc4101..35a0769 100644 --- a/service/cardholder/handle.go +++ b/service/cardholder/handle.go @@ -181,6 +181,7 @@ func HandleShopExchange(req *models.ReqStarShopExchange) (code string, rsp model // 按照规则扣除星星 enough, cardList := GetStarCardList(player, config, confStarShop.NeedStarNumber) + if !enough { code = code_msg.RECODE_MERGE_CARDHOLDER_STAR_NOTENOUGH_ERROR return diff --git a/service/cardholder/logic.go b/service/cardholder/logic.go index 32b1064..4b8a784 100644 --- a/service/cardholder/logic.go +++ b/service/cardholder/logic.go @@ -316,10 +316,13 @@ func GetStarCardList(player *Player, config *confcardholder.ActivityConfig, need if confCard.IsGold == 1 { continue } + if confCard.Star != i { + continue + } star := confCard.Star need := needStar - starAmount needCardCount := int(math.Ceil(float64(need) / float64(star))) - if cardCount-1 < needCardCount { + if needCardCount > cardCount-1 { needCardCount = cardCount - 1 } cardList[cardId] = needCardCount @@ -343,10 +346,13 @@ func GetStarCardList(player *Player, config *confcardholder.ActivityConfig, need if confCard.IsGold != 1 { continue } + if confCard.Star != i { + continue + } star := confCard.Star + 1 need := needStar - starAmount needCardCount := int(math.Ceil(float64(need) / float64(star))) - if cardCount-1 < needCardCount { + if needCardCount > cardCount-1 { needCardCount = cardCount - 1 } cardList[cardId] = needCardCount -- libgit2 0.21.0