From d2f36fc53f9bd426df28ba8d85df22d0984ac2ae Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Mon, 20 Oct 2025 16:03:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BF=83=E5=8A=A8=E5=80=BC=20=E5=B9=B8?= =?UTF-8?q?=E8=BF=90=E7=A4=BC=E7=89=A9=E5=92=8C=E6=99=AE=E9=80=9A=E7=A4=BC?= =?UTF-8?q?=E7=89=A9=E5=88=86=E5=BC=80=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/listener/gift/GiveGiftsListener.java | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/gift/GiveGiftsListener.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/gift/GiveGiftsListener.java index 61170012..6dc6af2d 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/gift/GiveGiftsListener.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/gift/GiveGiftsListener.java @@ -906,20 +906,29 @@ public class GiveGiftsListener implements MessageListener { //接受用户id Set acceptsUserIds = event.getAccepts().stream() .map(GiveAwayGiftRoomAccepts::getAcceptUserId).collect(Collectors.toSet()); - - // 幸运礼物比例 - BigDecimal luckyGiftRatio = gameLuckyGiftCommon.getLuckyGiftTargetRatio(event.getSysOrigin().name()); - - //总的心动值 - BigDecimal amountTotal = event.countSingleGiftGolds().multiply(luckyGiftRatio); - //先获取房间redis值 List liveHeartbeatCaches = liveHeartbeatCacheService.listLiveHeartbeat( event.getRoomId()); //组装一下心动值数据 key 用户id Map liveHeartbeatCacheMap = getLiveHeartbeatCacheMap(liveHeartbeatCaches); Map cacheMap = acceptsUserIds.stream().map(userId -> { - LiveHeartbeatCache liveHeartbeatCache = new LiveHeartbeatCache(); + + + // 礼物比例 + BigDecimal giftRatio; + if (event.checkLuckyGift()) { + // 幸运礼物比例 + giftRatio = gameLuckyGiftCommon.getLuckyGiftTargetRatio(event.getSysOrigin().name()); + } else { + RegionConfig acceptRegion = getUserRegion(userId); + giftRatio = Objects.equals(event.getSendUserId(), userId) ? + getAssistGiftToOwnGoldRatio(acceptRegion.getId()) : + getAssistGiftToOtherGoldRatio(acceptRegion.getId()); + } + //总的心动值 + BigDecimal amountTotal = event.countSingleGiftGolds().multiply(giftRatio); + + LiveHeartbeatCache liveHeartbeatCache = new LiveHeartbeatCache(); liveHeartbeatCache.setId(userId); liveHeartbeatCache.setHeartbeatVal(getHeartbeatTotal(amountTotal, Objects.nonNull(liveHeartbeatCacheMap.get(userId)) ? liveHeartbeatCacheMap.get(userId)