From 680043c9efbc24d0920c890ef48efe4ffdd4311d Mon Sep 17 00:00:00 2001 From: wangqing <408564126@qq.com> Date: Wed, 27 Mar 2024 17:22:06 +0800 Subject: [PATCH] fix: bindMobile --- .../com/luoo/user/controller/MyController.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) 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 f3f8f00..e28de9d 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 @@ -476,7 +476,7 @@ public class MyController extends BaseController { @ApiOperation(value = "13 绑定手机号", notes = "绑定手机号") @PostMapping ("/bindMobile") - public Result bindMobile(@RequestHeader(value = "Authorization", required = true) String authorization, @VerifyParam LoginReq loginReq) { + public Result bindMobile(@RequestHeader(value = "Authorization", required = true) String authorization, @VerifyParam LoginReq loginReq) { //验证是否登录,并且拿到ID UserLoginDto userLoginDto = getUserLoginDto(authorization); if (null == userLoginDto) { @@ -497,15 +497,18 @@ public class MyController extends BaseController { UserInfo userInfo2 = userInfoService.findById(userId); if (null != userInfo1) { // 如果绑定的手机号已存在 - userInfo2.setMobile(loginReq.getMobile()); - userInfoService.update(userInfo2); - userInfoService.deleteById(userInfo1.getId()); - return Result.success(); +// userInfo1.setMobile(loginReq.getMobile()); + userInfo1.setAppleId(userInfo2.getAppleId()); + userInfoService.update(userInfo1); + String token = userInfoService.loginOrRegister(userInfo1); + userInfoService.deleteById(userId); + return Result.success(token); } userInfo2.setMobile(loginReq.getMobile()); userInfoService.update(userInfo2); - return Result.success(); + String token = userInfoService.loginOrRegister(userInfo2); + return Result.success(token); }