1. fix bug
This commit is contained in:
2026-04-09 14:37:27 +08:00
parent 3672eb9991
commit b23c0df118

View File

@@ -28,6 +28,7 @@ package org.springblade.modules.common.service.impl;
import io.jsonwebtoken.lang.Assert;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.redis.debounce.DebounceClient;
import org.springblade.core.secure.utils.AuthUtil;
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));
if (!addCashCoupon) {
log.error("新增现金券失败");
throw new RuntimeException("操作失败");
throw new ServiceException("操作失败");
}
Boolean addedRecord = lotteryRecordService.addRecord(userId, request.getAmount());
if (!addedRecord) {
log.error("新增抽奖记录失败");
throw new RuntimeException("操作失败");
throw new ServiceException("操作失败");
}
} else {
long remaining = debounceClient.getRemainingTime(key, TimeUnit.SECONDS);
throw new RuntimeException("操作过于频繁,请" + remaining + "秒后重试");
throw new ServiceException("操作过于频繁,请" + remaining + "秒后重试");
}
return PRIZE;
}