From 9ff70aa3e4aae8fa2a607110e7ce645c8a363cc6 Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Wed, 3 Jun 2026 12:21:08 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=88=BF=E9=97=B4=E6=94=B9?= =?UTF-8?q?=E6=88=90=20=E9=98=BF=E8=AF=AD=E5=8C=BA=E5=92=8C=E9=9D=9E?= =?UTF-8?q?=E9=98=BF=E8=AF=AD=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../room/query/RoomVoiceDiscoverQryExe.java | 12 ++++++++- .../other/infra/constants/RegionConstant.java | 25 +++++++++++++++++++ .../live/impl/ActiveVoiceRoomServiceImpl.java | 10 +++++--- 3 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/constants/RegionConstant.java diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/room/query/RoomVoiceDiscoverQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/room/query/RoomVoiceDiscoverQryExe.java index 2a68d1ee..6f4a08ad 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/room/query/RoomVoiceDiscoverQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/room/query/RoomVoiceDiscoverQryExe.java @@ -17,6 +17,7 @@ import com.red.circle.other.domain.gateway.user.ability.UserSVipGateway; import com.red.circle.other.domain.model.user.UserProfile; import com.red.circle.other.infra.database.cache.service.other.MicUserCacheService; import com.red.circle.other.domain.rocket.RocketStatus; +import com.red.circle.other.infra.constants.RegionConstant; import com.red.circle.other.infra.database.cache.service.user.RegionRoomCacheService; import com.red.circle.other.infra.database.mongo.entity.live.ActiveVoiceRoom; import com.red.circle.other.infra.database.mongo.entity.live.RoomProfileManager; @@ -284,7 +285,16 @@ public class RoomVoiceDiscoverQryExe { private List filterEmptyRoomsByRegion(List emptyRooms, String sysOrigin, boolean isAllRegion, String region) { return emptyRooms.stream() .filter(room -> Objects.equals(sysOrigin, room.getSysOrigin())) - .filter(room -> isAllRegion || Objects.equals(region, room.getRegion())) + .filter(room -> { + if (isAllRegion) { + return true; + } + if (RegionConstant.isArabicRegionByCode(region)) { + return RegionConstant.isArabicRegionByCode(room.getRegion()); + } else { + return !RegionConstant.isArabicRegionByCode(room.getRegion()); + } + }) .collect(Collectors.toList()); } diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/constants/RegionConstant.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/constants/RegionConstant.java new file mode 100644 index 00000000..c54e40cb --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/constants/RegionConstant.java @@ -0,0 +1,25 @@ +package com.red.circle.other.infra.constants; + +/** + * 区域常量. + */ +public final class RegionConstant { + + private RegionConstant() {} + + /** 阿语区 region code */ + public static final String ARABIC_REGION_CODE = "AR"; + + /** 阿语区 regionId */ + public static final String ARABIC_REGION_ID = "2049084769873498113"; + + /** 通过 region code 判断是否阿语区(忽略大小写) */ + public static boolean isArabicRegionByCode(String regionCode) { + return ARABIC_REGION_CODE.equalsIgnoreCase(regionCode); + } + + /** 通过 regionId 判断是否阿语区(忽略大小写) */ + public static boolean isArabicRegionById(String regionId) { + return ARABIC_REGION_ID.equalsIgnoreCase(regionId); + } +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/live/impl/ActiveVoiceRoomServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/live/impl/ActiveVoiceRoomServiceImpl.java index 5c00dce4..2b384a7a 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/live/impl/ActiveVoiceRoomServiceImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/live/impl/ActiveVoiceRoomServiceImpl.java @@ -1,6 +1,7 @@ package com.red.circle.other.infra.database.mongo.service.live.impl; import com.red.circle.common.business.core.enums.SysOriginPlatformEnum; +import com.red.circle.other.infra.constants.RegionConstant; import com.red.circle.framework.mybatis.constant.PageConstant; import com.red.circle.other.infra.database.mongo.dto.query.live.ActiveVoiceRoomQuery; import com.red.circle.other.infra.database.mongo.dto.query.live.FamilyOnlineRoomQuery; @@ -117,9 +118,12 @@ public class ActiveVoiceRoomServiceImpl implements ActiveVoiceRoomService { @Override public List listDiscover(String sysOrigin, boolean isAllRegion, String region, Integer limit) { Criteria criteria = Criteria.where("sysOrigin").is(sysOrigin); - // 非全部区域时,仅展示用户当前 region 的房间 - if (!isAllRegion && StringUtils.isNotBlank(region)) { - criteria.and("region").is(region); + if (!isAllRegion) { + if (RegionConstant.isArabicRegionByCode(region)) { + criteria.and("region").is(RegionConstant.ARABIC_REGION_CODE); + } else { + criteria.and("region").ne(RegionConstant.ARABIC_REGION_CODE); + } } Query query = Query.query(criteria)