From 5676085e91e9cf0ac2c529f34f98a3ea92f3526a Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Thu, 8 Jan 2026 16:12:31 +0800 Subject: [PATCH] =?UTF-8?q?=E9=AD=85=E5=8A=9B=E5=80=BC=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 | 36 +++++++++++-------- 1 file changed, 22 insertions(+), 14 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 eb3a4ffd..ed293586 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 @@ -783,25 +783,21 @@ public class GiveGiftsListener implements MessageListener { //先获取房间redis值 List liveHeartbeatCaches = liveHeartbeatCacheService.listLiveHeartbeat( event.getRoomId()); - //组装一下心动值数据 key 用户id + //组装一下魅力值数据 key 用户id Map liveHeartbeatCacheMap = getLiveHeartbeatCacheMap(liveHeartbeatCaches); Map cacheMap = acceptsUserIds.stream().map(userId -> { - // 礼物比例 - BigDecimal giftRatio = BigDecimal.valueOf(1L); - if (event.checkLuckyGift()) { - // 幸运礼物比例 - giftRatio = gameLuckyGiftCommon.getLuckyGiftTargetRatio(event.getSysOrigin().name()); - } - //总的心动值 - BigDecimal amountTotal = event.countSingleGiftGolds().multiply(giftRatio); + // 礼物比例 + BigDecimal giftRatio = calcGiftRatio(event); + //总的魅力值 + 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) - .getHeartbeatVal() : null)); + LiveHeartbeatCache liveHeartbeatCache = new LiveHeartbeatCache(); + liveHeartbeatCache.setId(userId); + liveHeartbeatCache.setHeartbeatVal(getHeartbeatTotal(amountTotal, + Objects.nonNull(liveHeartbeatCacheMap.get(userId)) ? + liveHeartbeatCacheMap.get(userId).getHeartbeatVal() : null)); return liveHeartbeatCache; }).collect(Collectors.toMap(LiveHeartbeatCache::getId, v -> v)); liveHeartbeatCacheMap.putAll(cacheMap); @@ -810,6 +806,18 @@ public class GiveGiftsListener implements MessageListener { } } + private BigDecimal calcGiftRatio(GiveAwayGiftBatchEvent event) { + if (event.checkLuckyGift()) { + // 幸运礼物比例 + return gameLuckyGiftCommon.getLuckyGiftTargetRatio(event.getSysOrigin().name()); + } + if (event.checkCpGift()) { + return getAssistCpGiftGoldRatio("").multiply(new BigDecimal("10").max(new BigDecimal("0.7"))); + } + + return BigDecimal.valueOf(1L); + } + private Map getLiveHeartbeatCacheMap(List list) { return Optional.ofNullable(