好有校验逻辑修复

This commit is contained in:
tianfeng 2026-03-19 14:39:49 +08:00
parent cc22708e70
commit ad741c84c5

View File

@ -51,26 +51,25 @@ public class FriendCheckQryExe {
return Boolean.TRUE; return Boolean.TRUE;
} }
// 3. ContactMode // 3. 取目标用户的 ContactMode设置
ContactMode contactMode = userVipAbilitySettingService.getContactMode(reqUserId); ContactMode contactMode = userVipAbilitySettingService.getContactMode(targetUserId);
// 4. 拒绝联系 // 4. 拒绝联系
if (ContactMode.DO_NOT_DISTURB.equals(contactMode)) { if (ContactMode.DO_NOT_DISTURB.equals(contactMode)) {
// 检查是否好友
boolean isFriend = relationshipFriendService.checkFriend(reqUserId, targetUserId); boolean isFriend = relationshipFriendService.checkFriend(reqUserId, targetUserId);
if (!isFriend) { if (!isFriend) {
return Boolean.FALSE; return Boolean.FALSE;
} }
// 好友可以联系
return Boolean.TRUE; return Boolean.TRUE;
} }
// 5. VIP2_ABOVE / VIP5_ABOVE 限制联系对象 VIP 等级 // 5. VIP2_ABOVE / VIP5_ABOVE 检查发起方reqUserId的VIP等级是否足够
String targetVipLevel = userProfileGateway.getUserVipName(targetUserId); if (contactMode.getMinTargetVipLevel() != null) {
// 检查联系对象 VIP 等级 String reqVipName = userProfileGateway.getUserVipName(reqUserId);
SysNobleVipTypeEnum targetVip = SysNobleVipTypeEnum.getByName(targetVipLevel); SysNobleVipTypeEnum reqVip = SysNobleVipTypeEnum.getByName(reqVipName);
if (contactMode.getMinTargetVipLevel() != null && (targetVip == null || targetVip.ordinal() < contactMode.getMinTargetVipLevel().ordinal())) { if (reqVip != null && reqVip.ordinal() >= contactMode.getMinTargetVipLevel().ordinal()) {
return false; // 目标等级不够 return Boolean.TRUE;
}
} }
return relationshipFriendService return relationshipFriendService