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 71fc4156..b1c97d3d 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 @@ -141,18 +141,20 @@ public class UpdateUserProfileCmdExe { return null; } + // 旧版 App 保存头像等资料时会始终携带 countryId。身份锁定用户不能修改国家, + // 但不能因此阻断头像、昵称等无关字段保存,所以仅忽略本次国家字段。 + if (userIdentityService.hasCountryLockedIdentity(userProfile.getId())) { + log.warn("ignore locked user country change while updating profile userId={}, currentCountryId={}, requestedCountryId={}", + userProfile.getId(), userProfile.getCountryId(), cmd.getCountryId()); + return null; + } + Map countryMap = sysCountryCodeService.mapByIdes(Set.of(cmd.getCountryId())); SysCountryCode country = countryMap.get(cmd.getCountryId()); ResponseAssert.notNull(UserErrorCode.SYS_REGION_NOT_EXIST_ERROR, country); - assertAllowCountryChange(userProfile.getId()); return country; } - private void assertAllowCountryChange(Long userId) { - ResponseAssert.isFalse(UserErrorCode.USER_COUNTRY_UPDATE_NOT_ALLOWED, - userIdentityService.hasCountryLockedIdentity(userId)); - } - private void syncRoomCountry(Long userId, SysCountryCode country) { userProfileGateway.removeCacheAll(userId); String regionCode = userRegionGateway.getRegionCode(userId);