Commit 8b973f606f9a9264de272989c59a3c2e8dc996c1
1 parent
669a23b4
Exists in
master
and in
1 other branch
fix🐛:修复星星商店兑换bug
Showing
2 changed files
with
9 additions
and
2 deletions
Show diff stats
service/cardholder/handle.go
| ... | ... | @@ -181,6 +181,7 @@ func HandleShopExchange(req *models.ReqStarShopExchange) (code string, rsp model |
| 181 | 181 | |
| 182 | 182 | // 按照规则扣除星星 |
| 183 | 183 | enough, cardList := GetStarCardList(player, config, confStarShop.NeedStarNumber) |
| 184 | + | |
| 184 | 185 | if !enough { |
| 185 | 186 | code = code_msg.RECODE_MERGE_CARDHOLDER_STAR_NOTENOUGH_ERROR |
| 186 | 187 | return | ... | ... |
service/cardholder/logic.go
| ... | ... | @@ -316,10 +316,13 @@ func GetStarCardList(player *Player, config *confcardholder.ActivityConfig, need |
| 316 | 316 | if confCard.IsGold == 1 { |
| 317 | 317 | continue |
| 318 | 318 | } |
| 319 | + if confCard.Star != i { | |
| 320 | + continue | |
| 321 | + } | |
| 319 | 322 | star := confCard.Star |
| 320 | 323 | need := needStar - starAmount |
| 321 | 324 | needCardCount := int(math.Ceil(float64(need) / float64(star))) |
| 322 | - if cardCount-1 < needCardCount { | |
| 325 | + if needCardCount > cardCount-1 { | |
| 323 | 326 | needCardCount = cardCount - 1 |
| 324 | 327 | } |
| 325 | 328 | cardList[cardId] = needCardCount |
| ... | ... | @@ -343,10 +346,13 @@ func GetStarCardList(player *Player, config *confcardholder.ActivityConfig, need |
| 343 | 346 | if confCard.IsGold != 1 { |
| 344 | 347 | continue |
| 345 | 348 | } |
| 349 | + if confCard.Star != i { | |
| 350 | + continue | |
| 351 | + } | |
| 346 | 352 | star := confCard.Star + 1 |
| 347 | 353 | need := needStar - starAmount |
| 348 | 354 | needCardCount := int(math.Ceil(float64(need) / float64(star))) |
| 349 | - if cardCount-1 < needCardCount { | |
| 355 | + if needCardCount > cardCount-1 { | |
| 350 | 356 | needCardCount = cardCount - 1 |
| 351 | 357 | } |
| 352 | 358 | cardList[cardId] = needCardCount | ... | ... |