Explorar o código

添加中奖概率

kk hai 3 meses
pai
achega
8b52e29863

+ 6 - 2
game-business/src/main/java/com/game/business/controller/AppGameItemController.java

@@ -79,8 +79,12 @@ public class AppGameItemController extends BaseController
                 AppGameItem gameItem = list.get(i);
                 AppGameItemVO appGameItemVO = new AppGameItemVO();
                 BeanUtils.copyProperties(gameItem, appGameItemVO);
-                BigDecimal lotteryCount = new BigDecimal(gameItem.getLotteryCount());
-                appGameItemVO.setLotteryRate(lotteryCount.divide(lotteryCountSum).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
+                if(gameItem.getLotteryCount() == null || gameItem.getLotteryCount() == 0){
+                    appGameItemVO.setLotteryRate(0.00);
+                }else{
+                    BigDecimal lotteryCount = new BigDecimal(gameItem.getLotteryCount());
+                    appGameItemVO.setLotteryRate(lotteryCount.divide(lotteryCountSum).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
+                }
             }
         }