热游 PK返回0, 其他正常逻辑走

This commit is contained in:
tianfeng 2026-03-19 20:01:27 +08:00
parent fcc8985d9a
commit 1b07183de8
2 changed files with 12 additions and 8 deletions

View File

@ -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<HotGameUserProfile>()
.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);

View File

@ -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);
}
}