优化 房间进入后设置roomSpecialMikeType
This commit is contained in:
parent
dd6314cd74
commit
bdd2ef2f47
@ -18,6 +18,7 @@ import com.red.circle.other.app.dto.clientobject.room.RoomThemeCO;
|
||||
import com.red.circle.other.app.dto.cmd.room.RoomEntryCmd;
|
||||
import com.red.circle.other.domain.gateway.user.UserProfileGateway;
|
||||
import com.red.circle.other.domain.gateway.user.ability.UserRegionGateway;
|
||||
import com.red.circle.other.domain.model.user.NobleAbilityCO;
|
||||
import com.red.circle.other.infra.database.cache.service.other.RoomManagerCacheService;
|
||||
import com.red.circle.other.infra.database.cache.service.user.UserAgoraTokenCacheService;
|
||||
import com.red.circle.other.infra.database.mongo.entity.live.RoomProfile;
|
||||
@ -316,6 +317,14 @@ public class RoomEnterCmdExe {
|
||||
if (StringUtils.isBlank(manager.getSetting().getTakeMicRole())) {
|
||||
manager.getSetting().setTakeMicRole(RoomTakeMicRoleEnum.ALL.name());
|
||||
}
|
||||
|
||||
NobleAbilityCO userNobleAbility = userProfileGateway.getUserNobleAbility(manager.getUserId());
|
||||
if (Objects.nonNull(userNobleAbility)) {
|
||||
RoomSetting setting = manager.getSetting();
|
||||
setting.setRoomSpecialMikeType("TYPE_VIP" + userNobleAbility.getVipLevel());
|
||||
manager.setSetting(setting);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void checkSysOrigin(Long userId, String sysOrigin) {
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.red.circle.other.domain.gateway.user;
|
||||
|
||||
import com.red.circle.common.business.core.enums.SysOriginPlatformEnum;
|
||||
import com.red.circle.other.domain.model.user.NobleAbilityCO;
|
||||
import com.red.circle.other.inner.enums.material.PropsVipActualEquityEnum;
|
||||
import com.red.circle.tool.core.tuple.ImmutableKeyValuePair;
|
||||
import com.red.circle.other.domain.model.user.UserConsumptionLevel;
|
||||
@ -171,6 +172,14 @@ public interface UserProfileGateway {
|
||||
*/
|
||||
List<PropsVipActualEquityEnum> listUserActualEquityEnum(Long userId);
|
||||
|
||||
/**
|
||||
* 获取用户贵族能力.
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 贵族能力信息
|
||||
*/
|
||||
NobleAbilityCO getUserNobleAbility(Long userId);
|
||||
|
||||
/**
|
||||
* 修改用户签名为空.
|
||||
*/
|
||||
|
||||
@ -0,0 +1,29 @@
|
||||
package com.red.circle.other.domain.model.user;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 贵族能力返回对象.
|
||||
*
|
||||
* @author Claude AI
|
||||
* @since 2025-10-29
|
||||
*/
|
||||
@Data
|
||||
public class NobleAbilityCO {
|
||||
|
||||
/**
|
||||
* VIP类型.
|
||||
*/
|
||||
private String vipType;
|
||||
|
||||
/**
|
||||
* VIP等级.
|
||||
*/
|
||||
private Integer vipLevel;
|
||||
|
||||
/**
|
||||
* 房间最大成员数.
|
||||
*/
|
||||
private Integer roomMaxMember;
|
||||
|
||||
}
|
||||
@ -39,6 +39,11 @@ public enum UserKey implements RedisKeys {
|
||||
*/
|
||||
S_VIP_EQUITY,
|
||||
|
||||
/**
|
||||
* 用户贵族能力.
|
||||
*/
|
||||
NOBLE_ABILITY,
|
||||
|
||||
/**
|
||||
* 用户svip身份.
|
||||
*/
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.red.circle.other.infra.database.cache.service.user;
|
||||
|
||||
import com.red.circle.other.domain.model.user.NobleAbilityCO;
|
||||
import com.red.circle.other.inner.enums.material.PropsVipActualEquityEnum;
|
||||
import com.red.circle.other.infra.database.cache.entity.user.ConsumptionLevelCache;
|
||||
import com.red.circle.other.infra.database.cache.key.user.UserHashKey;
|
||||
@ -78,6 +79,11 @@ public interface UserCacheService {
|
||||
*/
|
||||
List<PropsVipActualEquityEnum> getUserActualEquityEnum(Long userId, Function<Long, List<PropsVipActualEquityEnum>> orElseGet);
|
||||
|
||||
/**
|
||||
* 获取用户贵族能力.
|
||||
*/
|
||||
NobleAbilityCO getUserNobleAbility(Long userId, Function<Long, NobleAbilityCO> orElseGet);
|
||||
|
||||
/**
|
||||
* 移除权益缓存.
|
||||
*/
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
package com.red.circle.other.infra.database.cache.service.user.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.red.circle.component.redis.service.RedisService;
|
||||
import com.red.circle.other.domain.model.user.NobleAbilityCO;
|
||||
import com.red.circle.other.inner.enums.material.PropsVipActualEquityEnum;
|
||||
import com.red.circle.tool.core.collection.CollectionUtils;
|
||||
import com.red.circle.tool.core.text.StringPool;
|
||||
@ -171,6 +173,31 @@ public class UserCacheServiceImpl implements UserCacheService {
|
||||
return actualEquity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NobleAbilityCO getUserNobleAbility(Long userId,
|
||||
Function<Long, NobleAbilityCO> orElseGet) {
|
||||
|
||||
String key = UserKey.NOBLE_ABILITY.getKey(userId);
|
||||
|
||||
String cacheValue = redisService.getString(key);
|
||||
|
||||
if (StringUtils.isNotBlank(cacheValue)) {
|
||||
try {
|
||||
return JSON.parseObject(cacheValue, NobleAbilityCO.class);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
NobleAbilityCO ability = orElseGet.apply(userId);
|
||||
|
||||
if (Objects.nonNull(ability)) {
|
||||
redisService.setIfAbsent(key, JSON.toJSONString(ability), 10, TimeUnit.MINUTES);
|
||||
}
|
||||
|
||||
return ability;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeUserActualEquityEnum(Long userId) {
|
||||
redisService.delete(UserKey.S_VIP_EQUITY.getKey(userId));
|
||||
|
||||
@ -11,6 +11,7 @@ import com.red.circle.other.domain.gateway.user.UserRunProfileTransportGateway;
|
||||
import com.red.circle.other.domain.model.user.OwnSpecialId;
|
||||
import com.red.circle.other.domain.model.user.UserConsumptionLevel;
|
||||
import com.red.circle.other.domain.model.user.UserProfile;
|
||||
import com.red.circle.other.domain.model.user.NobleAbilityCO;
|
||||
import com.red.circle.other.infra.common.props.PropsBackpackCommon;
|
||||
import com.red.circle.other.infra.common.props.UserBadgeCommon;
|
||||
import com.red.circle.other.infra.convertor.user.UserProfileInfraConvertor;
|
||||
@ -519,6 +520,36 @@ public class UserProfileGatewayImpl implements UserProfileGateway {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NobleAbilityCO getUserNobleAbility(Long userId) {
|
||||
return userCacheService.getUserNobleAbility(userId, this::getNobleAbility);
|
||||
}
|
||||
|
||||
private NobleAbilityCO getNobleAbility(Long userId) {
|
||||
UserProfile userProfile = getByUserId(userId);
|
||||
if (Objects.isNull(userProfile)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Set<Long> userVipPropsIds = getUserVipPropsIds(userProfile.getUseProps());
|
||||
if (CollectionUtils.isEmpty(userVipPropsIds)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<PropsNobleVipAbility> vipAbilities = propsNobleVipAbilityService.listByIds(userVipPropsIds);
|
||||
|
||||
if (CollectionUtils.isEmpty(vipAbilities)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PropsNobleVipAbility ability = vipAbilities.get(0);
|
||||
NobleAbilityCO result = new NobleAbilityCO();
|
||||
result.setVipType(ability.getVipType());
|
||||
result.setVipLevel(ability.getVipLevel());
|
||||
result.setRoomMaxMember(ability.getRoomMaxMember());
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得贵族道具ID
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user