|
@@ -180,13 +180,13 @@ public class PrizeController {
|
|
|
|
|
|
//抽奖方法
|
|
|
public synchronized HashMap<String, Object> luckDrawWay (Integer count,PrizeRecord prizeRecord,HashMap<String, Object> map){
|
|
|
- Random ran = new Random();
|
|
|
- int num = ran.nextInt(60);// 50%中奖概率
|
|
|
- Prize prize = prizeMapper.selectByPrimaryKey(num);
|
|
|
+// Random ran = new Random();
|
|
|
+// int num = ran.nextInt(60);// 50%中奖概率
|
|
|
+// Prize prize = prizeMapper.selectByPrimaryKey(num);
|
|
|
//以下是真实环境的抽奖原则
|
|
|
-// PrizeExample exp = new PrizeExample();
|
|
|
-// exp.setOrderByClause("RAND() LIMIT 1");
|
|
|
-// Prize prize = prizeMapper.selectByExample(exp).get(0);
|
|
|
+ PrizeExample exp = new PrizeExample();
|
|
|
+ exp.setOrderByClause("RAND() LIMIT 1");
|
|
|
+ Prize prize = prizeMapper.selectByExample(exp).get(0);
|
|
|
if (prize == null) {
|
|
|
count = -1;
|
|
|
} else {
|