diff --git a/luoo_user/src/main/java/com/luoo/user/controller/MyController.java b/luoo_user/src/main/java/com/luoo/user/controller/MyController.java index 827e171..a2e0ade 100644 --- a/luoo_user/src/main/java/com/luoo/user/controller/MyController.java +++ b/luoo_user/src/main/java/com/luoo/user/controller/MyController.java @@ -491,9 +491,18 @@ public class MyController extends BaseController { return Result.failed(StatusCode.USER_MOBILE_VERIFICATION_CODE_MISMATCH); } - UserInfo userInfo = userInfoService.findById(userId); - userInfo.setMobile(loginReq.getMobile()); - userInfoService.update(userInfo); + UserInfo userInfo1 =userInfoService.findByMobile(loginReq.getMobile()); + UserInfo userInfo2 = userInfoService.findById(userId); + if (null != userInfo1) { + // 如果绑定的手机号已存在 + userInfo1.setAppleId(userInfo2.getAppleId()); + userInfoService.update(userInfo1); + userInfoService.deleteById(userId); + return Result.success(); + + } + userInfo2.setMobile(loginReq.getMobile()); + userInfoService.update(userInfo2); return Result.success(); }