VIP权益-神秘隐身

This commit is contained in:
tianfeng 2026-03-16 18:30:16 +08:00
parent d7dfa915af
commit 425525f532

View File

@ -7,6 +7,7 @@ import com.red.circle.other.app.dto.clientobject.activity.RankingActivityRecordC
import com.red.circle.other.app.dto.clientobject.activity.RankingListCO; import com.red.circle.other.app.dto.clientobject.activity.RankingListCO;
import com.red.circle.other.app.dto.clientobject.activity.UserRankInfoCO; import com.red.circle.other.app.dto.clientobject.activity.UserRankInfoCO;
import com.red.circle.other.app.dto.cmd.activity.RankingListQueryCmd; import com.red.circle.other.app.dto.cmd.activity.RankingListQueryCmd;
import com.red.circle.other.domain.enums.VipAbilityType;
import com.red.circle.other.domain.gateway.user.UserProfileGateway; import com.red.circle.other.domain.gateway.user.UserProfileGateway;
import com.red.circle.other.domain.model.user.UserProfile; import com.red.circle.other.domain.model.user.UserProfile;
import com.red.circle.other.domain.ranking.RankingActivityType; import com.red.circle.other.domain.ranking.RankingActivityType;
@ -41,6 +42,8 @@ import java.util.stream.IntStream;
@RequiredArgsConstructor @RequiredArgsConstructor
public class RankingListQryExe { public class RankingListQryExe {
private static final String INVISIBLE_AVATAR = "https://tkm-likei.oss-ap-southeast-1.aliyuncs.com/default_avatar/yinshen.png";
private final RankingActivityGateway rankingActivityGateway; private final RankingActivityGateway rankingActivityGateway;
private final RankingActivityConvertor convertor; private final RankingActivityConvertor convertor;
private final UserProfileGateway userProfileGateway; private final UserProfileGateway userProfileGateway;
@ -81,9 +84,18 @@ public class RankingListQryExe {
UserProfileDTO userProfileDTO = userProfileMap.get(record.getUserId()); UserProfileDTO userProfileDTO = userProfileMap.get(record.getUserId());
if (userProfileDTO != null) { if (userProfileDTO != null) {
co.setAccount(userProfileDTO.getAccount()); boolean invisible = userProfileGateway.getUserVipAbility(
co.setNickname(userProfileDTO.getUserNickname()); record.getUserId(), VipAbilityType.MYSTERIOUS_INVISIBILITY);
co.setAvatar(userProfileDTO.getUserAvatar()); if (invisible) {
co.setUserId(null);
co.setAccount(null);
co.setNickname(maskNickname(userProfileDTO.getUserNickname()));
co.setAvatar(INVISIBLE_AVATAR);
} else {
co.setAccount(userProfileDTO.getAccount());
co.setNickname(userProfileDTO.getUserNickname());
co.setAvatar(userProfileDTO.getUserAvatar());
}
} }
return co; return co;
}) })
@ -244,6 +256,19 @@ public class RankingListQryExe {
} }
} }
/**
* 昵称脱敏只显示前两位
*/
private String maskNickname(String nickname) {
if (nickname == null || nickname.isEmpty()) {
return "**";
}
if (nickname.length() <= 2) {
return nickname;
}
return nickname.substring(0, 2) + "**";
}
/** /**
* 计算是一年中的第几周简化实现 * 计算是一年中的第几周简化实现
*/ */