抽奖金额问题

This commit is contained in:
2025-01-22 10:34:13 +08:00
parent 086e1961f9
commit d45e9cb749

View File

@@ -137,11 +137,13 @@ public class DiscSpinningServiceImpl extends ServiceImpl<DiscSpinningDao, DiscSp
double resultAmount = 0; double resultAmount = 0;
if (prize.getType() == 2) { if (prize.getType() == 2) {
double baseRandom = getRandomDouble(); double baseRandom = getRandomDouble();
double baseAmount = 0;
for (DiscSpinningAmount amount : amounts) { for (DiscSpinningAmount amount : amounts) {
if (baseRandom < amount.getRandom()) { if (baseRandom < amount.getRandom()) {
resultAmount = getRandomDouble() * amount.getMaxAmount(); resultAmount = baseAmount + getRandomDouble() * amount.getMaxAmount();
break; break;
} }
baseAmount = amount.getMaxAmount();
} }
if (resultAmount < 0.01) { if (resultAmount < 0.01) {