fix: bindMobile

main
wangqing 8 months ago
parent 1160f43bcc
commit 680043c9ef

@ -476,7 +476,7 @@ public class MyController extends BaseController {
@ApiOperation(value = "13 绑定手机号", notes = "绑定手机号") @ApiOperation(value = "13 绑定手机号", notes = "绑定手机号")
@PostMapping ("/bindMobile") @PostMapping ("/bindMobile")
public Result<Void> bindMobile(@RequestHeader(value = "Authorization", required = true) String authorization, @VerifyParam LoginReq loginReq) { public Result<String> bindMobile(@RequestHeader(value = "Authorization", required = true) String authorization, @VerifyParam LoginReq loginReq) {
//验证是否登录并且拿到ID //验证是否登录并且拿到ID
UserLoginDto userLoginDto = getUserLoginDto(authorization); UserLoginDto userLoginDto = getUserLoginDto(authorization);
if (null == userLoginDto) { if (null == userLoginDto) {
@ -497,15 +497,18 @@ public class MyController extends BaseController {
UserInfo userInfo2 = userInfoService.findById(userId); UserInfo userInfo2 = userInfoService.findById(userId);
if (null != userInfo1) { if (null != userInfo1) {
// 如果绑定的手机号已存在 // 如果绑定的手机号已存在
userInfo2.setMobile(loginReq.getMobile()); // userInfo1.setMobile(loginReq.getMobile());
userInfoService.update(userInfo2); userInfo1.setAppleId(userInfo2.getAppleId());
userInfoService.deleteById(userInfo1.getId()); userInfoService.update(userInfo1);
return Result.success(); String token = userInfoService.loginOrRegister(userInfo1);
userInfoService.deleteById(userId);
return Result.success(token);
} }
userInfo2.setMobile(loginReq.getMobile()); userInfo2.setMobile(loginReq.getMobile());
userInfoService.update(userInfo2); userInfoService.update(userInfo2);
return Result.success(); String token = userInfoService.loginOrRegister(userInfo2);
return Result.success(token);
} }

Loading…
Cancel
Save