From 1b07183de876ee7d6115824d71d8d73afe7e601d Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Thu, 19 Mar 2026 20:01:27 +0800 Subject: [PATCH] =?UTF-8?q?=E7=83=AD=E6=B8=B8=20PK=E8=BF=94=E5=9B=9E0,=20?= =?UTF-8?q?=E5=85=B6=E4=BB=96=E6=AD=A3=E5=B8=B8=E9=80=BB=E8=BE=91=E8=B5=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/service/game/HotGameServiceImpl.java | 16 ++++++++++------ .../src/test/java/GameVipLevelTest.java | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) 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); } }