修复:收口登录提示文案
This commit is contained in:
+2
-2
@@ -209,8 +209,8 @@ public class UserController {
|
||||
boolean exists = userDO != null;
|
||||
String nickname = exists ? userDO.getNickname() : null;
|
||||
String message = exists
|
||||
? (nickname != null && !nickname.isEmpty() ? "找到账号,登录后将进入:" + nickname : "账号已注册")
|
||||
: "该账号未注册";
|
||||
? (nickname != null && !nickname.isEmpty() ? "该账号已注册,昵称:" + nickname : "该账号已注册,可继续登录")
|
||||
: "该账号未注册或已删除";
|
||||
return Result.success(new LoginAccountAvailabilityVO(exists, nickname, message));
|
||||
}
|
||||
|
||||
|
||||
+28
-9
@@ -572,7 +572,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
|
||||
.last("limit 1")
|
||||
);
|
||||
if (userDO == null) {
|
||||
return buildLoginShopSelection(List.of(), false, "该账号未注册");
|
||||
return buildLoginShopSelection(List.of(), false, "该账号未注册或已删除");
|
||||
}
|
||||
if (userDO.getStatus() != null && !Integer.valueOf(1).equals(userDO.getStatus())) {
|
||||
return buildLoginShopSelection(List.of(), false, "该账号已被禁用");
|
||||
@@ -649,10 +649,10 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
|
||||
.last("limit 1")
|
||||
);
|
||||
if (userDO == null) {
|
||||
return buildLoginShopSelection(List.of(), false, "该账号不存在");
|
||||
return buildLoginShopSelection(List.of(), false, "该账号未注册或已删除");
|
||||
}
|
||||
if (userDO.getType() == null || userDO.getType() < 2) {
|
||||
return buildLoginShopSelection(List.of(), false, "该账号没有后台管理权限");
|
||||
return buildLoginShopSelection(List.of(), false, "该账号不是后台管理账号");
|
||||
}
|
||||
if (userDO.getStatus() != null && !Integer.valueOf(1).equals(userDO.getStatus())) {
|
||||
return buildLoginShopSelection(List.of(), false, "该账号已被禁用");
|
||||
@@ -663,7 +663,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
|
||||
boolean allowShoplessLogin = shops.isEmpty();
|
||||
String message = allowShoplessLogin
|
||||
? "当前暂无启用店铺,可直接登录后台创建店铺"
|
||||
: buildLoginShopMessage(shops);
|
||||
: buildAdminLoginShopMessage(shops);
|
||||
return buildLoginShopSelection(shops, allowShoplessLogin, message);
|
||||
}
|
||||
|
||||
@@ -682,7 +682,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
|
||||
.eq(UserDO::getAccount, normalizedAccount)
|
||||
);
|
||||
|
||||
assertUserAvailable(userDO);
|
||||
assertLoginAccountAvailable(userDO);
|
||||
|
||||
// 检查是否为未设置密码的账号
|
||||
if (ENCODED_UNSET_PASSWORD.equals(userDO.getPassword())) {
|
||||
@@ -761,7 +761,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
|
||||
.eq(UserDO::getAccount, normalizedAccount)
|
||||
);
|
||||
|
||||
assertUserAvailable(userDO);
|
||||
assertLoginAccountAvailable(userDO);
|
||||
|
||||
if (!passwordEncoder.matches(loginRequestDTO.getPassword(), userDO.getPassword())) {
|
||||
throw new RuntimeException("密码错误");
|
||||
@@ -769,7 +769,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
|
||||
|
||||
Integer userType = userDO.getType();
|
||||
if (userType == null || userType < 2) {
|
||||
throw new RuntimeException("您没有后台管理权限");
|
||||
throw new RuntimeException("该账号不是后台管理账号");
|
||||
}
|
||||
|
||||
syncDefaultPermissions(userDO.getId(), userType);
|
||||
@@ -1193,6 +1193,15 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
|
||||
}
|
||||
}
|
||||
|
||||
private void assertLoginAccountAvailable(UserDO userDO) {
|
||||
if (userDO == null || Integer.valueOf(1).equals(userDO.getIsDelete())) {
|
||||
throw new RuntimeException("该账号未注册或已删除");
|
||||
}
|
||||
if (userDO.getStatus() != null && !Integer.valueOf(1).equals(userDO.getStatus())) {
|
||||
throw new RuntimeException("该账号已被禁用");
|
||||
}
|
||||
}
|
||||
|
||||
private void validateVerificationCode(String phone, String verificationCode) {
|
||||
if (!StringUtils.hasText(phone) || !StringUtils.hasText(verificationCode)) {
|
||||
throw new RuntimeException("验证码不能为空");
|
||||
@@ -1242,14 +1251,24 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
|
||||
|
||||
private String buildLoginShopMessage(List<ShopSimpleVO> shops) {
|
||||
if (shops == null || shops.isEmpty()) {
|
||||
return "当前暂无可选店铺";
|
||||
return "当前暂无可登录店铺";
|
||||
}
|
||||
if (shops.size() == 1) {
|
||||
return "已匹配到 1 家可登录店铺";
|
||||
return "已匹配到 1 家可登录店铺,已为您默认选中";
|
||||
}
|
||||
return "该账号已绑定多家店铺,请选择本次登录店铺";
|
||||
}
|
||||
|
||||
private String buildAdminLoginShopMessage(List<ShopSimpleVO> shops) {
|
||||
if (shops == null || shops.isEmpty()) {
|
||||
return "当前暂无启用店铺,可直接登录后台创建店铺";
|
||||
}
|
||||
if (shops.size() == 1) {
|
||||
return "当前已有 1 家启用店铺,已为您默认选中";
|
||||
}
|
||||
return "当前已有 " + shops.size() + " 家启用店铺,请选择本次登录店铺";
|
||||
}
|
||||
|
||||
private Long resolveUserLoginShopId(UserDO userDO, Long requestedShopId) {
|
||||
Long normalizedRequestedShopId = validateAndNormalizeShopId(requestedShopId);
|
||||
List<Long> activeShopIds = userShopBindingSupport.listActiveShopIdsByUserId(userDO.getId());
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
# 2026-03-26 登录提示文案收口
|
||||
|
||||
## 本次目标
|
||||
|
||||
- 统一前后台登录相关的账号检测、店铺预加载、实际登录提交时的提示口径。
|
||||
- 避免用户删除后再用旧账号登录时,前端仍看到“未注册 / 不存在 / 无权限”这类不一致提示。
|
||||
|
||||
## 实际修改
|
||||
|
||||
### 1. 前台登录账号实时检测文案统一
|
||||
|
||||
- 文件:`YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/controller/UserController.java`
|
||||
- 调整 `GET /user/check/login-account/{account}` 返回文案:
|
||||
- 账号存在且有昵称时:`该账号已注册,昵称:xxx`
|
||||
- 账号存在但昵称为空时:`该账号已注册,可继续登录`
|
||||
- 账号查不到时:`该账号未注册或已删除`
|
||||
- 同时去掉了原先“登录后将进入:昵称”的误导性表述,避免把昵称误写成登录目标。
|
||||
|
||||
### 2. 登录前店铺选择提示收口
|
||||
|
||||
- 文件:`YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/service/impl/UserServiceImpl.java`
|
||||
- 前台账号登录店铺预加载:
|
||||
- 账号查不到时统一为 `该账号未注册或已删除`
|
||||
- 单店铺场景改为 `已匹配到 1 家可登录店铺,已为您默认选中`
|
||||
- 后台账号登录店铺预加载:
|
||||
- 账号查不到时统一为 `该账号未注册或已删除`
|
||||
- 非后台账号时提示 `该账号不是后台管理账号`
|
||||
- 平台管理员可登录任意启用店铺的场景,单独使用更准确的文案:
|
||||
- 1 家店铺:`当前已有 1 家启用店铺,已为您默认选中`
|
||||
- 多家店铺:`当前已有 N 家启用店铺,请选择本次登录店铺`
|
||||
|
||||
### 3. 实际登录提交异常口径统一
|
||||
|
||||
- 文件:`YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/service/impl/UserServiceImpl.java`
|
||||
- 新增仅用于登录链路的账号可用性校验:
|
||||
- 账号不存在或已删除:`该账号未注册或已删除`
|
||||
- 账号被停用:`该账号已被禁用`
|
||||
- 前台密码登录与后台登录均切换为这套提示,避免提交登录后又退回成“用户不存在”。
|
||||
|
||||
## 结果说明
|
||||
|
||||
- 用户被按最后一个店铺绑定删除后,旧账号在登录页会统一表现为“未注册或已删除”,和当前业务规则一致。
|
||||
- 后台管理员登录前的门店提示不再误写成“已绑定多家店铺”,更符合“管理员可选择任意启用店铺”的实际逻辑。
|
||||
- 本轮只调整提示文案和登录链路异常口径,没有修改登录权限、店铺绑定、删除策略等业务规则。
|
||||
|
||||
## 涉及文件
|
||||
|
||||
- `YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/controller/UserController.java`
|
||||
- `YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/service/impl/UserServiceImpl.java`
|
||||
|
||||
## SQL 变更
|
||||
|
||||
- 无
|
||||
|
||||
## 验证计划
|
||||
|
||||
- 后端执行 `mvn -q -DskipTests compile`
|
||||
Reference in New Issue
Block a user