From eaa5b3e4352b1dfa8e12406293f834125f97096b Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Thu, 4 Sep 2025 10:25:23 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=88=BF=E9=97=B4=E5=88=97=E8=A1=A8):=20?= =?UTF-8?q?=E5=8C=BA=E5=9F=9F=E9=9A=94=E7=A6=BB=E6=96=B0=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../live/impl/ActiveVoiceRoomServiceImpl.java | 80 ++++++++----------- 1 file changed, 32 insertions(+), 48 deletions(-) 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 342eaf15..9c9a2fbc 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 @@ -36,6 +36,10 @@ public class ActiveVoiceRoomServiceImpl implements ActiveVoiceRoomService { private final MongoTemplate mongoTemplate; + private static final Set SA_REGIONS = Set.of("BD", "IN", "PK"); + private static final Set AR_REGIONS = Set.of("AE", "BH", "DJ", "DZ", "EG", "EY", "ER", "IL", "IQ", "JO", "KM", "KW", "LB", "LY", "MA", "MR", "OM", "PS", "QA", "SA", "SD", "SO", "SS", "SY", "TD", "TN", "YE"); + private static final Set OTHER_REGIONS = Set.of("OTHER", "PH", "ID", "TR", "GH", "IR", "AF", "NG", "DE", "MYS", "TM", "AZ", "NP"); + @Override public void saveOrUpdate(ActiveVoiceRoom param) { try { @@ -169,60 +173,40 @@ public class ActiveVoiceRoomServiceImpl implements ActiveVoiceRoomService { } private List getSpecialRegions(String region) { - // 孟加拉、印度、土耳其、阿拉伯 只能看到自己的区域,别的区域也看不到这三个区域 - Set regions = new HashSet<>(List.of("BD", "IN", "TR", "AR")); - if (regions.contains(region)) { - return List.of(region); + if (SA_REGIONS.contains(region)) { + return new ArrayList<>(SA_REGIONS); } + + if (AR_REGIONS.contains(region)) { + return new ArrayList<>(AR_REGIONS); + } + + if (OTHER_REGIONS.contains(region)) { + return new ArrayList<>(OTHER_REGIONS); + } + return new ArrayList<>(); } private List getRegions(String region) { - List result = new ArrayList<>(List.of("BD", "IN", "TR", "AR")); - List pakistanList = new ArrayList<>(List.of("PK", "PK-2", "PK-3", "PK-4", "PK-5", "PK-6", "PK-7", "PK-8")); - // 伊朗和法国 - Set iran = new HashSet<>(List.of("IR", "FR", "AF")); - if (iran.contains(region)) { - iran.remove(region); - result.addAll(iran); - return result; + List excludeRegions = new ArrayList<>(); + + if (SA_REGIONS.contains(region)) { + excludeRegions.addAll(AR_REGIONS); + excludeRegions.addAll(OTHER_REGIONS); + } else if (AR_REGIONS.contains(region)) { + excludeRegions.addAll(SA_REGIONS); + excludeRegions.addAll(OTHER_REGIONS); + } else if (OTHER_REGIONS.contains(region)) { + excludeRegions.addAll(SA_REGIONS); + excludeRegions.addAll(AR_REGIONS); + } else { + excludeRegions.addAll(SA_REGIONS); + excludeRegions.addAll(AR_REGIONS); + excludeRegions.addAll(OTHER_REGIONS); } - - // 巴基斯坦、德国、斯里兰卡 - Set pakistan = new HashSet<>(pakistanList); - if (pakistan.contains(region)) { - result.addAll(List.of("IND-2", "IND-3", "IND-4", "TG", "CA", "NP", "NP-2", "NP-3", "ES", "DE", "LK")); - } - - // 德国、斯里兰卡 - Set germany = new HashSet<>(List.of("DE", "LK")); - if (germany.contains(region)) { - germany.remove(region); - germany.addAll(pakistanList); - result.addAll(germany); - return result; - } - - // 巴基斯坦、印度、多哥、加拿大、尼泊尔、西班牙 - Set togo = new HashSet<>(List.of("IND-2", "IND-3", "IND-4", "TG", "CA", "NP", "NP-2", "NP-3", "ES")); - if (togo.contains(region)) { - togo.remove(region); - togo.addAll(pakistanList); - result.addAll(togo); - return result; - } - // 泰国 看不了孟加拉、印度、巴基斯坦 - if ("TH".equals(region)) { - return List.of("BD", "IN", "TR", "PK", "PK-2", "PK-3", "PK-4", "PK-5", "PK-6", "PK-7", "PK-8"); - } - // 尼泊尔 -// Set nepal = new HashSet<>(List.of("NP", "NP-2", "NP-3")); -// if (nepal.contains(region)) { -// nepal.remove(region); -// result.addAll(nepal); -// return result; -// } - return result; + + return excludeRegions; }