From 33c04e83e8dcbcaee4c2e16985520fbc4cffc7ec Mon Sep 17 00:00:00 2001 From: Jack <46790855@qq.com> Date: Sun, 25 Jan 2026 01:09:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=AE=B6=E6=B3=A8=E5=86=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E9=82=80=E8=AF=B7=E7=A0=81=E5=8F=AF=E9=80=89=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/AccountUserBaseServiceImpl.java | 14 +++++- .../mall/common/constant/AuthConstant.java | 5 ++ .../suisung/mall/common/domain/UserDto.java | 46 +++++++++++++++---- 3 files changed, 53 insertions(+), 12 deletions(-) diff --git a/mall-account/src/main/java/com/suisung/mall/account/service/impl/AccountUserBaseServiceImpl.java b/mall-account/src/main/java/com/suisung/mall/account/service/impl/AccountUserBaseServiceImpl.java index 2f1e9f96..8c2a1082 100644 --- a/mall-account/src/main/java/com/suisung/mall/account/service/impl/AccountUserBaseServiceImpl.java +++ b/mall-account/src/main/java/com/suisung/mall/account/service/impl/AccountUserBaseServiceImpl.java @@ -208,7 +208,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl getUserInfo(Integer user_id) { QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("user_id", user_id).select(AccountUserBase.class, info -> !info.getColumn().equals("user_password")); - AccountUserBase accountUserBase = getOne(queryWrapper); + AccountUserBase accountUserBase = getOne(queryWrapper, false); setIdentityByUser(accountUserBase); AccountUserInfo userInfo = accountUserInfoService.get(user_id); @@ -296,6 +296,16 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl roles; // 服务端返回rid 角色编号: 0-用户;2-商家;3-门店;9-平台; @@ -31,6 +32,8 @@ public class UserDto implements Serializable { private Integer site_id = 0; //分站编号 private String store_id; private String chain_id; + private Integer user_is_admin;//用户类型:对应user_base 的 is_admin:0-普通用户;1-管理员;2-入驻商家;3-代理商; + private String invite_code; // 代理商邀请码 /** * 用户角色是平台 @@ -91,18 +94,41 @@ public class UserDto implements Serializable { } /** - * 获取用户类型:对应user_base 的 is_admin:0-普通用户;1-管理员;2-入驻商家; + * 代理商端 + * + * @return + */ + public boolean isAgent() { + return ObjectUtil.equal(client_id, AuthConstant.AGENT_CLIENT_ID); + } + + /** + * 获取用户类型:对应user_base 的 user_is_admin:0-普通用户;1-管理员;2-入驻商家;3-代理商; + * + * @return + */ +// public Integer getUserType() { +// Integer user_type = CommonConstant.USER_TYPE_NORMAL; // 用户类型,对应user_base 的 user_is_admin:0-普通用户;1-管理员;2-入驻商家;3-代理商; +// if (isAdmin()) { +// user_type = CommonConstant.USER_TYPE_ADMIN; +// } else if (isMerchant()) { +// user_type = CommonConstant.USER_TYPE_MCH; +// } else if (isAgent()) { +// user_type = CommonConstant.USER_TYPE_AGENT; +// } else { +// user_type = CommonConstant.USER_TYPE_NORMAL; +// } +// +// return user_type; +// } + + /** + * 获取用户类型:对应user_base 的 user_is_admin:0-普通用户;1-管理员;2-入驻商家;3-代理商; * * @return */ public Integer getUserType() { - Integer user_type = CommonConstant.USER_TYPE_NORMAL; // 用户类型,对应user_base 的 is_admin:0-普通用户;1-管理员;2-入驻商家; - if (isAdmin()) { - user_type = CommonConstant.USER_TYPE_ADMIN; - } else if (isMerchant()) { - user_type = CommonConstant.USER_TYPE_MCH; - } - - return user_type; + // 用户类型,对应user_base 的 is_admin:0-普通用户;1-管理员;2-入驻商家; + return CheckUtil.isNotEmpty(this.user_is_admin) ? this.user_is_admin : CommonConstant.USER_TYPE_NORMAL; } }