From c9a031b6c26ca98b832dc85f387e920f494cc767 Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Thu, 5 Feb 2026 18:36:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=AB=98=E7=AD=89=E7=BA=A7vi?= =?UTF-8?q?p=E8=87=AA=E5=8A=A8=E8=A6=86=E7=9B=96=E4=BD=A9=E6=88=B4?= =?UTF-8?q?=E4=BD=8E=E7=AD=89=E7=BA=A7vip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user/UserRunProfileTransportGatewayImpl.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/UserRunProfileTransportGatewayImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/UserRunProfileTransportGatewayImpl.java index 709dfabc..7e44ed40 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/UserRunProfileTransportGatewayImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/UserRunProfileTransportGatewayImpl.java @@ -438,38 +438,42 @@ public class UserRunProfileTransportGatewayImpl implements UserRunProfileTranspo // 2. 检查当前VIP是否过期 Timestamp now = TimestampUtils.now(); - if (currentVip != null && currentVip.getExpireTime().after(now)) { + if (currentVip == null) { // 当前VIP未过期,无需切换 return; } // 3. 如果当前VIP已过期,卸下它 - if (currentVip != null) { + if (currentVip.getExpireTime().before(now)) { propsBackpackService.unloadUseProps(userId, PropsCommodityType.NOBLE_VIP); log.info("用户VIP已过期并卸下, userId={}, propsId={}, expireTime={}", userId, currentVip.getPropsId(), currentVip.getExpireTime()); } // 4. 使用最高等级的可用VIP - useMaxNobleVip(userId); + useMaxNobleVip(userId, currentVip.getPropsId()); } /** * 切换到最高等级VIP */ - private void useMaxNobleVip(Long userId) { + private void useMaxNobleVip(Long userId, Long currentVipId) { PropsNobleVipAbilityDTO abilityDTO = propsNobleVipGateway.getUserMaxAbilityDTO(userId); if (Objects.isNull(abilityDTO)) { log.info("用户没有可用的VIP道具, userId={}", userId); return; } + Long vipId = abilityDTO.getId(); + if (Objects.equals(vipId, currentVipId)) { + return; + } - propsBackpackCommon.switchUseProps(userId, abilityDTO.getId()); + propsBackpackCommon.switchUseProps(userId, vipId); propsBackpackCommon.switchUseProps(userId, abilityDTO.getAvatarFrameId()); propsBackpackCommon.switchUseProps(userId, abilityDTO.getDataCardId()); propsBackpackCommon.switchUseProps(userId, abilityDTO.getCarId()); - log.info("自动切换到最高等级VIP, userId={}, vipId={}", userId, abilityDTO.getId()); + log.info("自动切换到最高等级VIP, userId={}, vipId={}", userId, vipId); } private UsePropsDTO mergeUserUsePropsEntity(