From 305d511c19f63ed394c87cb58c97613236718a7f Mon Sep 17 00:00:00 2001 From: zhx Date: Wed, 8 Jul 2026 19:23:53 +0800 Subject: [PATCH] fix(console): allow admin country changes --- .../app/user/UserBaseInfoServiceImpl.java | 42 +++---------------- 1 file changed, 5 insertions(+), 37 deletions(-) diff --git a/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/user/UserBaseInfoServiceImpl.java b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/user/UserBaseInfoServiceImpl.java index 2237f7ca..27f11f57 100644 --- a/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/user/UserBaseInfoServiceImpl.java +++ b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/user/UserBaseInfoServiceImpl.java @@ -206,7 +206,7 @@ public class UserBaseInfoServiceImpl implements boolean countryChanged = countryChanged(param, currentProfile); if (countryChanged) { - fillCountryAndAssertAllowed(param, currentProfile); + fillConsoleCountry(param, currentProfile); } userProfileClient.updateSelectiveById(userAppConvertor.toUserBaseInfoCmd(param)); @@ -228,52 +228,20 @@ public class UserBaseInfoServiceImpl implements && !Objects.equals(param.getCountryId(), currentProfile.getCountryId()); } - private void fillCountryAndAssertAllowed(UserProfileUpdateCmd param, + private void fillConsoleCountry(UserProfileUpdateCmd param, UserProfileDTO currentProfile) { SysCountryCodeDTO country = ResponseAssert.requiredSuccess( countryCodeClient.getById(param.getCountryId())); ResponseAssert.notNull(UserErrorCode.SYS_REGION_NOT_EXIST_ERROR, country); - boolean locked = hasCountryLockedIdentity(param.getId()); - log.warn("console country-change identity check userId={}, locked={}, currentCountryId={}, targetCountryId={}", - param.getId(), locked, currentProfile.getCountryId(), param.getCountryId()); - // 国家变更只限制平台身份用户;普通用户允许后台多次调整并同步房间国家。 - ResponseAssert.isFalse(UserErrorCode.USER_COUNTRY_UPDATE_NOT_ALLOWED, locked); + // 后台用户资料编辑是最高权限路径,只校验目标国家有效,不受主播/代理/BD 等用户身份限制。 + log.warn("console country-change userId={}, currentCountryId={}, targetCountryId={}", + param.getId(), currentProfile.getCountryId(), param.getCountryId()); param.setCountryCode(country.getAlphaTwo()); param.setCountryName(country.getCountryName()); } - private boolean hasCountryLockedIdentity(Long userId) { - TeamMemberDTO teamMember = getTeamMember(userId); - boolean anchor = Objects.nonNull(teamMember); - boolean agent = anchor && TeamMemberRole.OWN.eq(teamMember.getRole()); - boolean bd = checkBd(userId); - boolean bdLeader = checkBdLeader(userId); - log.warn("console country-change identity detail userId={}, anchor={}, agent={}, bd={}, bdLeader={}, teamMemberRole={}", - userId, anchor, agent, bd, bdLeader, - Objects.isNull(teamMember) ? null : teamMember.getRole()); - return anchor || agent || bd || bdLeader; - } - - private TeamMemberDTO getTeamMember(Long userId) { - try { - return ResponseAssert.requiredSuccess(teamProfileClient.getByMemberId(userId)); - } catch (Exception ex) { - log.warn("console country-change team member check failed, treat as no team member, userId={}", - userId, ex); - return null; - } - } - - private boolean checkBd(Long userId) { - return Boolean.TRUE.equals(ResponseAssert.requiredSuccess(bdTeamInfoClient.check(userId))); - } - - private boolean checkBdLeader(Long userId) { - return Boolean.TRUE.equals(ResponseAssert.requiredSuccess(bdTeamLeaderClient.check(userId))); - } - @Override public void updateVestUserInfo(UserBaseInfoCmd cmd) { cmd.setUpdateTime(TimestampUtils.now());