فهرست منبع

添加中奖概率

kk 3 ماه پیش
والد
کامیت
8b52e29863
1فایلهای تغییر یافته به همراه6 افزوده شده و 2 حذف شده
  1. 6 2
      game-business/src/main/java/com/game/business/controller/AppGameItemController.java

+ 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());
+                }
             }
         }