提交 749ee2bf authored 作者: lvbencai's avatar lvbencai

合并分支 'lbc_dev' 到 'qa'

fix(lottery): 修正抽奖奖品配置和中奖概率逻辑 查看合并请求 !145
...@@ -3,7 +3,6 @@ package com.wangxiaolu.promotion; ...@@ -3,7 +3,6 @@ package com.wangxiaolu.promotion;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
......
...@@ -63,14 +63,16 @@ public class LotteryCoreDaoImpl implements LotteryCoreDao { ...@@ -63,14 +63,16 @@ public class LotteryCoreDaoImpl implements LotteryCoreDao {
LotteryRecordDto result = BeanUtils.transitionDto(record, LotteryRecordDto.class); LotteryRecordDto result = BeanUtils.transitionDto(record, LotteryRecordDto.class);
ArrayList<String> prizeList = new ArrayList<>(); ArrayList<String> prizeList = new ArrayList<>();
prizeList.add("三等奖"); // 下标和抽奖返回的数值有关系,0:一等奖, 1:二等奖, 2:三等奖, -1:未中奖
prizeList.add("一等奖"); prizeList.add("一等奖");
prizeList.add("二等奖"); prizeList.add("二等奖");
prizeList.add("三等奖"); prizeList.add("三等奖");
prizeList.add("二等奖"); prizeList.add("谢谢参与");
prizeList.add("三等奖"); prizeList.add("三等奖");
prizeList.add("二等奖"); prizeList.add("二等奖");
prizeList.add("三等奖"); prizeList.add("三等奖");
prizeList.add("谢谢参与");
result.setPrizes(prizeList); result.setPrizes(prizeList);
return result; return result;
...@@ -135,12 +137,15 @@ public class LotteryCoreDaoImpl implements LotteryCoreDao { ...@@ -135,12 +137,15 @@ public class LotteryCoreDaoImpl implements LotteryCoreDao {
/** /**
* 简单动态概率 * 简单动态概率
* 一等奖:10%,二等奖:20%,三等奖:40%,谢谢参与:30%
*/ */
private int simpleDynamicPrize() { private int simpleDynamicPrize() {
int r = new Random().nextInt(100); int r = new Random().nextInt(100);
if (r < 10) { if (r < 10) {
return 1; return 0;
} else if (r < 30) { } else if (r < 30) {
return 1;
} else if (r < 70) {
return 2; return 2;
} else { } else {
return 3; return 3;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论