|
|
@ -105,13 +105,13 @@ public class AwardRecordServiceImpl extends BaseServiceImpl<AwardRecordMapper, A
|
|
|
|
awardRecordCriteria2.andEqualTo("userId", userId).andBetween("createDateTime",start,end);
|
|
|
|
awardRecordCriteria2.andEqualTo("userId", userId).andBetween("createDateTime",start,end);
|
|
|
|
//今日抽总次数
|
|
|
|
//今日抽总次数
|
|
|
|
Integer todayCount = awardRecordMapper.selectCountByExample(awardRecordExample2);
|
|
|
|
Integer todayCount = awardRecordMapper.selectCountByExample(awardRecordExample2);
|
|
|
|
|
|
|
|
Integer awardNum = awardRule.getAwardNum();
|
|
|
|
if (todayAwardCount >= 1){
|
|
|
|
if (todayAwardCount >= 1){
|
|
|
|
logger.info("此用户已抽中过奖品");
|
|
|
|
logger.info("此用户已抽中过奖品");
|
|
|
|
isAward = false;
|
|
|
|
isAward = false;
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
|
int range = (int) (1 / awardRate);
|
|
|
|
int range = (int) (1 / awardRate);
|
|
|
|
int num = 1 + (int)(Math.random()*(range - 1 + 1));
|
|
|
|
int num = 1 + (int)(Math.random()*(range - 1 + 1));
|
|
|
|
Integer awardNum = awardRule.getAwardNum();
|
|
|
|
|
|
|
|
if ( 0 == isHaveBigAward){
|
|
|
|
if ( 0 == isHaveBigAward){
|
|
|
|
//无大奖
|
|
|
|
//无大奖
|
|
|
|
if (awardNum > 0){
|
|
|
|
if (awardNum > 0){
|
|
|
@ -148,8 +148,10 @@ public class AwardRecordServiceImpl extends BaseServiceImpl<AwardRecordMapper, A
|
|
|
|
awardType = 2;
|
|
|
|
awardType = 2;
|
|
|
|
awardRule.setIsHaveBigAward(0);
|
|
|
|
awardRule.setIsHaveBigAward(0);
|
|
|
|
awardRule.setUpdateDateTime(new Date());
|
|
|
|
awardRule.setUpdateDateTime(new Date());
|
|
|
|
awardRuleMapper.updateByPrimaryKeySelective(awardRule);
|
|
|
|
}else {
|
|
|
|
|
|
|
|
awardRule.setAwardNum(awardNum - 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
awardRuleMapper.updateByPrimaryKeySelective(awardRule);
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
|
ajaxResult.setRetmsg("未中奖");
|
|
|
|
ajaxResult.setRetmsg("未中奖");
|
|
|
|
ajaxResult.setRetcode(AjaxResult.SUCCESS);
|
|
|
|
ajaxResult.setRetcode(AjaxResult.SUCCESS);
|
|
|
|