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)