diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/query/RankingListQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/query/RankingListQryExe.java index c572f88d..6741f4e8 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/query/RankingListQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/query/RankingListQryExe.java @@ -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.UserRankInfoCO; 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.model.user.UserProfile; import com.red.circle.other.domain.ranking.RankingActivityType; @@ -41,6 +42,8 @@ import java.util.stream.IntStream; @RequiredArgsConstructor 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 RankingActivityConvertor convertor; private final UserProfileGateway userProfileGateway; @@ -81,9 +84,18 @@ public class RankingListQryExe { UserProfileDTO userProfileDTO = userProfileMap.get(record.getUserId()); if (userProfileDTO != null) { - co.setAccount(userProfileDTO.getAccount()); - co.setNickname(userProfileDTO.getUserNickname()); - co.setAvatar(userProfileDTO.getUserAvatar()); + boolean invisible = userProfileGateway.getUserVipAbility( + record.getUserId(), VipAbilityType.MYSTERIOUS_INVISIBILITY); + 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; }) @@ -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) + "**"; + } + /** * 计算是一年中的第几周(简化实现) */