抽奖金额问题
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user