抽奖 发放金币增加限制

This commit is contained in:
tianfeng 2025-10-21 16:49:34 +08:00
parent c69679b883
commit d2a4aff598
2 changed files with 18 additions and 9 deletions

View File

@ -696,7 +696,12 @@ public enum GoldOrigin {
/**
* 家族群聊付费解锁.
*/
FAMILY_GROUP_CHAT_AMOUNT("Family group chat amount")
FAMILY_GROUP_CHAT_AMOUNT("Family group chat amount"),
/**
* 抽奖奖励
*/
LOTTERY_REWARD("Lottery reward"),
;
private final String desc;

View File

@ -23,6 +23,8 @@ import com.red.circle.wallet.inner.endpoint.wallet.WalletGoldClient;
import com.red.circle.wallet.inner.model.cmd.DiamondReceiptCmd;
import com.red.circle.wallet.inner.model.cmd.GoldReceiptCmd;
import java.math.BigDecimal;
import com.red.circle.wallet.inner.model.enums.GoldOrigin;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@ -113,17 +115,19 @@ public class LotteryPrizeGrantServiceImpl implements LotteryPrizeGrantService {
return;
}
BigDecimal amount = prize.getPrizeValue();
// 防止配错导致发送大量金币
long goldAmount = prize.getPropsId() > 100000L ? 10000 : prize.getPropsId();
BigDecimal amount = BigDecimal.valueOf(goldAmount);
walletGoldClient.changeBalance(
GoldReceiptCmd.builder()
.opsIncome()
.userId(userId)
.sysOrigin(userProfile.getOriginSys())
.eventId(recordNo)
.origin(SysCurrencySendReasonEnum.LOTTERY.name())
.originDescribe("抽奖奖励")
.origin(GoldOrigin.LOTTERY_REWARD)
.originDescribe(GoldOrigin.LOTTERY_REWARD.name())
.amount(amount)
.remark("抽奖获得金币")
.remark("")
.build()
);
@ -175,7 +179,7 @@ public class LotteryPrizeGrantServiceImpl implements LotteryPrizeGrantService {
.setPropsId(prize.getPropsId())
.setType("PROPS")
.setOrigin(SendPropsOrigin.LOTTERY_REWARD.name())
.setOriginDesc("抽奖奖励")
.setOriginDesc(SendPropsOrigin.LOTTERY_REWARD.getDesc())
.setDays(days)
.setUseProps(Boolean.FALSE)
.setAllowGive(Boolean.FALSE)
@ -206,7 +210,7 @@ public class LotteryPrizeGrantServiceImpl implements LotteryPrizeGrantService {
.setPropsId(prize.getPropsId())
.setType(type)
.setOrigin(SendPropsOrigin.LOTTERY_REWARD.name())
.setOriginDesc("抽奖奖励")
.setOriginDesc(SendPropsOrigin.LOTTERY_REWARD.getDesc())
.setDays(days)
.setUseProps(Boolean.FALSE)
.setAllowGive(Boolean.FALSE)
@ -215,7 +219,7 @@ public class LotteryPrizeGrantServiceImpl implements LotteryPrizeGrantService {
propsBackpackClient.giveProps(cmd);
// 发送通知
propsBackpackClient.givePropsNotify(userId, type, days, prize.getPropsId());
// propsBackpackClient.givePropsNotify(userId, type, days, prize.getPropsId());
log.info("Backpack props granted, userId: {}, type: {}, propsId: {}, days: {}, recordNo: {}",
userId, type, prize.getPropsId(), days, recordNo);
@ -246,7 +250,7 @@ public class LotteryPrizeGrantServiceImpl implements LotteryPrizeGrantService {
);
// 发送通知
propsBackpackClient.givePropsNotify(userId, "BADGE", days, prize.getPropsId());
// propsBackpackClient.givePropsNotify(userId, "BADGE", days, prize.getPropsId());
log.info("Badge granted, userId: {}, badgeId: {}, days: {}, expireType: {}, recordNo: {}",
userId, prize.getPropsId(), days, expireType, recordNo);