feat: allow guest room discovery
This commit is contained in:
parent
246b5afeab
commit
16f9c12151
@ -149,6 +149,12 @@ gateway:
|
|||||||
- /open-other-test/**
|
- /open-other-test/**
|
||||||
- /open-console-test/**
|
- /open-console-test/**
|
||||||
- /sys/config/country
|
- /sys/config/country
|
||||||
|
# Apple 审核游客模式:只开放首页展示所需的只读接口,进房接口仍要求 token。
|
||||||
|
- /sys/config/banner
|
||||||
|
- /room/live-voice/discovery
|
||||||
|
- /room/live-voice/search
|
||||||
|
- /room/profile/specific
|
||||||
|
- /activity/leaderboard/appLeaderboard
|
||||||
- /sys/config/banner/start-page
|
- /sys/config/banner/start-page
|
||||||
- /oss/sts
|
- /oss/sts
|
||||||
- /oss/upload
|
- /oss/upload
|
||||||
|
|||||||
@ -76,13 +76,18 @@ public class RoomVoiceDiscoverQryExe {
|
|||||||
public List<RoomVoiceProfileCO> execute(AppExtCommand cmd) {
|
public List<RoomVoiceProfileCO> execute(AppExtCommand cmd) {
|
||||||
long totalStart = System.currentTimeMillis();
|
long totalStart = System.currentTimeMillis();
|
||||||
long stepStart = totalStart;
|
long stepStart = totalStart;
|
||||||
Long reqUserId = cmd.requiredReqUserId();
|
Long reqUserId = cmd.getReqUserId();
|
||||||
String sysOrigin = cmd.requireReqSysOrigin();
|
String sysOrigin = cmd.requireReqSysOrigin();
|
||||||
|
|
||||||
boolean allRegionWhiteListUser = roomRegionFilterCommon.canViewAllRegions(reqUserId);
|
boolean guestDiscovery = Objects.isNull(reqUserId);
|
||||||
RegionConfig currentRegion = roomRegionFilterCommon.requireRegionConfig(reqUserId);
|
boolean allRegionWhiteListUser = guestDiscovery
|
||||||
|
|| roomRegionFilterCommon.canViewAllRegions(reqUserId);
|
||||||
|
// 游客没有账号区域,使用独立 ALL_REGION 缓存浏览公开房间,不参与个性化区域计算。
|
||||||
|
RegionConfig currentRegion = guestDiscovery
|
||||||
|
? new RegionConfig().setRegionCode("GUEST")
|
||||||
|
: roomRegionFilterCommon.requireRegionConfig(reqUserId);
|
||||||
String region = currentRegion.getRegionCode();
|
String region = currentRegion.getRegionCode();
|
||||||
UserProfile userProfile = userProfileGateway.getByUserId(reqUserId);
|
UserProfile userProfile = guestDiscovery ? null : userProfileGateway.getByUserId(reqUserId);
|
||||||
stepStart = logDiscoveryStep("prepare", stepStart, reqUserId, sysOrigin, region);
|
stepStart = logDiscoveryStep("prepare", stepStart, reqUserId, sysOrigin, region);
|
||||||
|
|
||||||
String key = discoveryCacheKey(sysOrigin, region, allRegionWhiteListUser);
|
String key = discoveryCacheKey(sysOrigin, region, allRegionWhiteListUser);
|
||||||
|
|||||||
@ -31,7 +31,9 @@ public class RoomVoiceProfileByRoomAccountQryExe {
|
|||||||
if (roomVoiceProfile == null || !Objects.equals(roomVoiceProfile.getSysOrigin(), cmd.requireReqSysOrigin())) {
|
if (roomVoiceProfile == null || !Objects.equals(roomVoiceProfile.getSysOrigin(), cmd.requireReqSysOrigin())) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (!userRegionGateway.checkEqRegion(cmd.requiredReqUserId(), roomVoiceProfile.getUserId())) {
|
// 游客只能查看公开房间资料;登录用户仍保持原有同区域搜索限制。
|
||||||
|
if (Objects.nonNull(cmd.getReqUserId())
|
||||||
|
&& !userRegionGateway.checkEqRegion(cmd.getReqUserId(), roomVoiceProfile.getUserId())) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return roomVoiceProfile;
|
return roomVoiceProfile;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user