diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/HotGameServiceImpl.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/HotGameServiceImpl.java index 2ea9889b..87756370 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/HotGameServiceImpl.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/HotGameServiceImpl.java @@ -125,7 +125,7 @@ public class HotGameServiceImpl implements HotGameService { userProfile.getOriginSys())); } - Integer vipLevel = getVipLevel(query.longUid()); + Integer vipLevel = getVipLevel(query.longUid(), userProfile.getCountryCode()); return new HotGameResponse() .setErrorCode(HotGameErrorEnum.SUCCESS.getErrorCode()) .setData(HotGameUserProfile.builder() @@ -139,15 +139,19 @@ public class HotGameServiceImpl implements HotGameService { ); } - public Integer getVipLevel(Long userId) { + public Integer getVipLevel(Long userId, String countryCode) { LocalDateTime now = LocalDateTime.now(); - - // 【新增】检查是否为每月的 1-7号 或 16-22号 - int dayOfMonth = now.getDayOfMonth(); - if ((dayOfMonth >= 1 && dayOfMonth <= 7) || (dayOfMonth >= 16 && dayOfMonth <= 22)) { + // 巴基斯坦返回0 其他正常 + if ("PK".equals(countryCode)) { return 0; } + // 【新增】检查是否为每月的 1-7号 或 16-22号 +// int dayOfMonth = now.getDayOfMonth(); +// if ((dayOfMonth >= 1 && dayOfMonth <= 7) || (dayOfMonth >= 16 && dayOfMonth <= 22)) { +// return 0; +// } + try { String cacheKey = VIP_LEVEL_CACHE_KEY + userId; Object cachedLevel = redisService.redisTemplate().opsForValue().get(cacheKey); diff --git a/rc-service/rc-service-other/other-start/src/test/java/GameVipLevelTest.java b/rc-service/rc-service-other/other-start/src/test/java/GameVipLevelTest.java index 55fcb467..204d4fc2 100644 --- a/rc-service/rc-service-other/other-start/src/test/java/GameVipLevelTest.java +++ b/rc-service/rc-service-other/other-start/src/test/java/GameVipLevelTest.java @@ -31,7 +31,7 @@ public class GameVipLevelTest { @Test public void testGetVipLevel() { - Integer vipLevel = hotGameService.getVipLevel(TEST_USER_ID); + Integer vipLevel = hotGameService.getVipLevel(TEST_USER_ID, ""); log.info("用户VIP等级: userId={}, vipLevel={}", TEST_USER_ID, vipLevel); } @@ -44,7 +44,7 @@ public class GameVipLevelTest { @Test public void testGetVipLevelAfterRecharge() { userActivityRechargeService.recordRecharge(TEST_USER_ID, new BigDecimal("500"), MonthlyRechargeType.SHIPPING_AGENT); - Integer vipLevel = hotGameService.getVipLevel(TEST_USER_ID); + Integer vipLevel = hotGameService.getVipLevel(TEST_USER_ID, ""); log.info("充值后VIP等级: userId={}, vipLevel={}", TEST_USER_ID, vipLevel); } }