feat(房间列表): 区域隔离新逻辑
This commit is contained in:
parent
8977de0366
commit
eaa5b3e435
@ -36,6 +36,10 @@ public class ActiveVoiceRoomServiceImpl implements ActiveVoiceRoomService {
|
|||||||
|
|
||||||
private final MongoTemplate mongoTemplate;
|
private final MongoTemplate mongoTemplate;
|
||||||
|
|
||||||
|
private static final Set<String> SA_REGIONS = Set.of("BD", "IN", "PK");
|
||||||
|
private static final Set<String> 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<String> OTHER_REGIONS = Set.of("OTHER", "PH", "ID", "TR", "GH", "IR", "AF", "NG", "DE", "MYS", "TM", "AZ", "NP");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void saveOrUpdate(ActiveVoiceRoom param) {
|
public void saveOrUpdate(ActiveVoiceRoom param) {
|
||||||
try {
|
try {
|
||||||
@ -169,60 +173,40 @@ public class ActiveVoiceRoomServiceImpl implements ActiveVoiceRoomService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<String> getSpecialRegions(String region) {
|
private List<String> getSpecialRegions(String region) {
|
||||||
// 孟加拉、印度、土耳其、阿拉伯 只能看到自己的区域,别的区域也看不到这三个区域
|
if (SA_REGIONS.contains(region)) {
|
||||||
Set<String> regions = new HashSet<>(List.of("BD", "IN", "TR", "AR"));
|
return new ArrayList<>(SA_REGIONS);
|
||||||
if (regions.contains(region)) {
|
|
||||||
return List.of(region);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (AR_REGIONS.contains(region)) {
|
||||||
|
return new ArrayList<>(AR_REGIONS);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (OTHER_REGIONS.contains(region)) {
|
||||||
|
return new ArrayList<>(OTHER_REGIONS);
|
||||||
|
}
|
||||||
|
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> getRegions(String region) {
|
private List<String> getRegions(String region) {
|
||||||
List<String> result = new ArrayList<>(List.of("BD", "IN", "TR", "AR"));
|
List<String> excludeRegions = new ArrayList<>();
|
||||||
List<String> pakistanList = new ArrayList<>(List.of("PK", "PK-2", "PK-3", "PK-4", "PK-5", "PK-6", "PK-7", "PK-8"));
|
|
||||||
// 伊朗和法国
|
if (SA_REGIONS.contains(region)) {
|
||||||
Set<String> iran = new HashSet<>(List.of("IR", "FR", "AF"));
|
excludeRegions.addAll(AR_REGIONS);
|
||||||
if (iran.contains(region)) {
|
excludeRegions.addAll(OTHER_REGIONS);
|
||||||
iran.remove(region);
|
} else if (AR_REGIONS.contains(region)) {
|
||||||
result.addAll(iran);
|
excludeRegions.addAll(SA_REGIONS);
|
||||||
return result;
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 巴基斯坦、德国、斯里兰卡
|
return excludeRegions;
|
||||||
Set<String> 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<String> germany = new HashSet<>(List.of("DE", "LK"));
|
|
||||||
if (germany.contains(region)) {
|
|
||||||
germany.remove(region);
|
|
||||||
germany.addAll(pakistanList);
|
|
||||||
result.addAll(germany);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 巴基斯坦、印度、多哥、加拿大、尼泊尔、西班牙
|
|
||||||
Set<String> 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<String> nepal = new HashSet<>(List.of("NP", "NP-2", "NP-3"));
|
|
||||||
// if (nepal.contains(region)) {
|
|
||||||
// nepal.remove(region);
|
|
||||||
// result.addAll(nepal);
|
|
||||||
// return result;
|
|
||||||
// }
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user