From 0ccb38c460c5a48184c1f1721ddf784989045911 Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Tue, 17 Mar 2026 19:06:24 +0800 Subject: [PATCH] =?UTF-8?q?VIP=E6=9D=83=E7=9B=8A=E6=9A=82=E6=97=B6=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=99=BD=E5=90=8D=E5=8D=95=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gateway/user/UserProfileGatewayImpl.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/UserProfileGatewayImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/UserProfileGatewayImpl.java index 1fc9de35..b11e50a3 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/UserProfileGatewayImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/UserProfileGatewayImpl.java @@ -20,6 +20,7 @@ import com.red.circle.other.infra.common.props.PropsBackpackCommon; import com.red.circle.other.infra.common.props.UserBadgeCommon; import com.red.circle.other.infra.convertor.user.UserProfileInfraConvertor; import com.red.circle.other.infra.database.cache.entity.user.ConsumptionLevelCache; +import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheService; import com.red.circle.other.infra.database.cache.service.user.UserCacheService; import com.red.circle.other.infra.database.cache.service.user.UserRegionCacheService; import com.red.circle.other.infra.database.cache.service.user.UserRelationshipCacheService; @@ -45,6 +46,7 @@ import com.red.circle.other.inner.enums.material.PropsCommodityType; import com.red.circle.other.inner.enums.material.PropsVipActualEquityEnum; import com.red.circle.other.inner.model.cmd.user.UserProfileListQryCmd; import com.red.circle.other.inner.model.dto.material.UsePropsDTO; +import com.red.circle.other.inner.model.dto.sys.EnumConfigDTO; import com.red.circle.other.inner.model.dto.user.props.UserUsePropsDTO; import com.red.circle.tool.core.collection.CollectionUtils; import com.red.circle.tool.core.date.TimestampUtils; @@ -88,6 +90,7 @@ public class UserProfileGatewayImpl implements UserProfileGateway { private final UserRunProfileCacheService userRunProfileCacheService; private final UserRegionCacheService userRegionCacheService; private final UserVipAbilitySettingService userVipAbilitySettingService; + private final EnumConfigCacheService enumConfigCacheService; @Override @@ -502,13 +505,32 @@ public class UserProfileGatewayImpl implements UserProfileGateway { @Override public boolean getUserVipAbility(Long userId, VipAbilityType abilityType) { + if (!inWhiteList(userId)) return false; + boolean hasVipLevel = abilityType.hasAbility(resolveUserVipName(userId)); boolean switchOn = userVipAbilitySettingService.isEnabled(userId, abilityType); return hasVipLevel && switchOn; } + private boolean inWhiteList(Long userId) { + EnumConfigDTO configDTO = enumConfigCacheService.getByCode("LOGIN_WHITE_CONFIG", "LIKEI"); + String whiteConfig = Optional.ofNullable(configDTO).map(EnumConfigDTO::getVal).orElse(null); + UserProfile userProfile = getByUserId(userId); + if (whiteConfig == null || userProfile == null) { + return false; + } + + List whiteIds = StringUtils.isNotBlank(whiteConfig) ? Arrays.asList(whiteConfig.split(",")) : Collections.emptyList(); + if (!whiteIds.contains(userProfile.getAccount())) { + return false; + } + return true; + } + @Override public BigDecimal getUserVipBenefit(Long userId, VipBenefitType benefitType) { + if (!inWhiteList(userId)) return BigDecimal.ONE; + return benefitType.getValue(resolveUserVipName(userId)); }