update:
1. fix bug
This commit is contained in:
@@ -28,6 +28,7 @@ package org.springblade.modules.common.service.impl;
|
|||||||
import io.jsonwebtoken.lang.Assert;
|
import io.jsonwebtoken.lang.Assert;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springblade.core.log.exception.ServiceException;
|
||||||
import org.springblade.core.redis.debounce.DebounceClient;
|
import org.springblade.core.redis.debounce.DebounceClient;
|
||||||
import org.springblade.core.secure.utils.AuthUtil;
|
import org.springblade.core.secure.utils.AuthUtil;
|
||||||
import org.springblade.modules.api.request.LotteryDrawRequest;
|
import org.springblade.modules.api.request.LotteryDrawRequest;
|
||||||
@@ -122,16 +123,16 @@ public class CommonLotteryPrizeServiceImpl extends BaseServiceImpl<CommonLottery
|
|||||||
Boolean addCashCoupon = cashCouponService.addCashCoupon(new MarketCashCouponApiDTO().setAmount(request.getAmount()).setUserId(userId).setSourceType(MarketBusinessModule.LOTTERY));
|
Boolean addCashCoupon = cashCouponService.addCashCoupon(new MarketCashCouponApiDTO().setAmount(request.getAmount()).setUserId(userId).setSourceType(MarketBusinessModule.LOTTERY));
|
||||||
if (!addCashCoupon) {
|
if (!addCashCoupon) {
|
||||||
log.error("新增现金券失败");
|
log.error("新增现金券失败");
|
||||||
throw new RuntimeException("操作失败");
|
throw new ServiceException("操作失败");
|
||||||
}
|
}
|
||||||
Boolean addedRecord = lotteryRecordService.addRecord(userId, request.getAmount());
|
Boolean addedRecord = lotteryRecordService.addRecord(userId, request.getAmount());
|
||||||
if (!addedRecord) {
|
if (!addedRecord) {
|
||||||
log.error("新增抽奖记录失败");
|
log.error("新增抽奖记录失败");
|
||||||
throw new RuntimeException("操作失败");
|
throw new ServiceException("操作失败");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
long remaining = debounceClient.getRemainingTime(key, TimeUnit.SECONDS);
|
long remaining = debounceClient.getRemainingTime(key, TimeUnit.SECONDS);
|
||||||
throw new RuntimeException("操作过于频繁,请" + remaining + "秒后重试");
|
throw new ServiceException("操作过于频繁,请" + remaining + "秒后重试");
|
||||||
}
|
}
|
||||||
return PRIZE;
|
return PRIZE;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user