diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/UpdateUserProfileCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/UpdateUserProfileCmdExe.java index 1cbcea45..98b6c680 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/UpdateUserProfileCmdExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/UpdateUserProfileCmdExe.java @@ -103,6 +103,10 @@ public class UpdateUserProfileCmdExe { processCountry(cmd, userProfile); + // 处理照片状态 + processPhotoStatus(updateUserProfile.getBackgroundPhotos(), userProfile.getBackgroundPhotos()); + processPhotoStatus(updateUserProfile.getPersonalPhotos(), userProfile.getPersonalPhotos()); + userProfileGateway.updateSelectiveById(updateUserProfile); // 同步修改房间国家 @@ -253,4 +257,27 @@ public class UpdateUserProfileCmdExe { baseInfo.setCountryId(null); } + /** + * 处理照片状态:新照片设置为待审核,已存在照片保持原状态. + */ + private void processPhotoStatus(List newPhotos, List originalPhotos) { + if (CollectionUtils.isEmpty(newPhotos)) { + return; + } + + for (PhotoItem photo : newPhotos) { + boolean isNew = CollectionUtils.isEmpty(originalPhotos) + || originalPhotos.stream().noneMatch(p -> Objects.equals(p.getUrl(), photo.getUrl())); + + if (isNew) { + photo.setStatus(PhotoAuditStatus.PENDING.getCode()); + } else { + originalPhotos.stream() + .filter(p -> Objects.equals(p.getUrl(), photo.getUrl())) + .findFirst() + .ifPresent(p -> photo.setStatus(p.getStatus())); + } + } + } + } diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/CensorProfileListener.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/CensorProfileListener.java index 20688690..84efc301 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/CensorProfileListener.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/CensorProfileListener.java @@ -284,12 +284,9 @@ public class CensorProfileListener implements MessageListener { String labelNames = response.formatLabelString(); - if (response.checkBlock()) { + if (!response.checkPass()) { // 审核不通过,记录违规 - photoViolationHandle(param.getUserId(), censorContent.getContent(), - labelNames, approvalType); - // 删除违规图片 - ossServiceClient.remove(censorContent.getContent()); + photoViolationHandle(param.getUserId(), censorContent.getContent(), labelNames, approvalType); // 更新MongoDB中图片状态 updatePhotoStatus(param.getUserId(), censorContent.getContent(), PhotoAuditStatus.REJECTED.getCode(), labelNames, approvalType);