好有校验逻辑修复

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