diff --git a/luoo_user/src/main/java/com/luoo/user/controller/LoginController.java b/luoo_user/src/main/java/com/luoo/user/controller/LoginController.java index 85f20f2..1f8e557 100644 --- a/luoo_user/src/main/java/com/luoo/user/controller/LoginController.java +++ b/luoo_user/src/main/java/com/luoo/user/controller/LoginController.java @@ -141,7 +141,6 @@ public class LoginController extends BaseController { } @ApiOperation(value = "2.1 appleId登录/注册", notes = "成功后返回authorization") @PostMapping("/appleIdLogin") - @GlobalInterceptor(frequencyType = RequestFrequencyTypeEnum.HOUR, requestFrequencyThreshold = 12) public Result appleIdLogin(HttpServletRequest request,@VerifyParam AppleLoginReq appleLoginReq) { @@ -178,7 +177,6 @@ public class LoginController extends BaseController { @ApiOperation(value = "2.2 微信wxId登录/注册", notes = "成功后返回authorization") @PostMapping("/wxIdLogin") - @GlobalInterceptor(frequencyType = RequestFrequencyTypeEnum.HOUR, requestFrequencyThreshold = 12) public Result wxIdLogin(HttpServletRequest request,@VerifyParam WeChatLoginReq weChatLoginReq) { // 如果有手机号,是首次微信登录时绑定流程 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 a2e0ade..f3f8f00 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 @@ -117,6 +117,8 @@ public class MyController extends BaseController { UserInfo user = userInfoService.findById(userLoginDto.getUserId()); UserRespDTO userRespDTO = getUserRespDTO(user, true, Collections.emptySet()); userRespDTO.setMobile(user.getMobile()); + userRespDTO.setWxId(user.getWxId()); + userRespDTO.setAppleId(user.getAppleId()); return Result.success(userRespDTO); } @@ -495,9 +497,9 @@ public class MyController extends BaseController { UserInfo userInfo2 = userInfoService.findById(userId); if (null != userInfo1) { // 如果绑定的手机号已存在 - userInfo1.setAppleId(userInfo2.getAppleId()); - userInfoService.update(userInfo1); - userInfoService.deleteById(userId); + userInfo2.setMobile(loginReq.getMobile()); + userInfoService.update(userInfo2); + userInfoService.deleteById(userInfo1.getId()); return Result.success(); } diff --git a/luoo_user/src/main/java/com/luoo/user/dto/response/UserRespDTO.java b/luoo_user/src/main/java/com/luoo/user/dto/response/UserRespDTO.java index 7631b0a..cca1ed4 100644 --- a/luoo_user/src/main/java/com/luoo/user/dto/response/UserRespDTO.java +++ b/luoo_user/src/main/java/com/luoo/user/dto/response/UserRespDTO.java @@ -46,4 +46,12 @@ public class UserRespDTO implements Serializable { @ApiModelProperty(value = "手机号") private String mobile; + + @ApiModelProperty(value = "apple id") + private String appleId; + + + @ApiModelProperty(value = "微信 wx id") + private String wxId; + } diff --git a/luoo_user/src/main/java/com/luoo/user/service/UserInfoService.java b/luoo_user/src/main/java/com/luoo/user/service/UserInfoService.java index bbb51f7..1697518 100644 --- a/luoo_user/src/main/java/com/luoo/user/service/UserInfoService.java +++ b/luoo_user/src/main/java/com/luoo/user/service/UserInfoService.java @@ -315,6 +315,7 @@ public class UserInfoService { userInfo.setLastLoginIp(loginUserInfo.getLastLoginIp()); } + userInfo.setWxId(loginUserInfo.getWxId()); if (!UserStatusEnum.ENABLE.getStatus().equals(userInfo.getStatus())) { return null; } diff --git a/luoo_user/src/main/java/com/luoo/user/service/WeChatAouth2Service.java b/luoo_user/src/main/java/com/luoo/user/service/WeChatAouth2Service.java index cf96675..a8f1d31 100644 --- a/luoo_user/src/main/java/com/luoo/user/service/WeChatAouth2Service.java +++ b/luoo_user/src/main/java/com/luoo/user/service/WeChatAouth2Service.java @@ -110,13 +110,13 @@ public class WeChatAouth2Service { redisTemplate.opsForValue().set(loginReq.getCode(),accessToken.getOpenid(),10,TimeUnit.MINUTES); return Result.failed(StatusCode.WECHAT_MOBILE_UNBINDED); } - UserInfo loginUserInfo = new UserInfo(); +// UserInfo loginUserInfo = new UserInfo(); // loginUserInfo.setWxId(accessToken.getOpenid()); // loginUserInfo.setMobile(loginReq.getMobile()); - loginUserInfo.setLastUseDeviceId(loginReq.getDeviceId()); - loginUserInfo.setLastUseDeviceBrand(loginReq.getDeviceBrand()); - loginUserInfo.setLastLoginIp(ipAddress); - String token = userInfoService.wechatlogin(loginUserInfo); + userInfo.setLastUseDeviceId(loginReq.getDeviceId()); + userInfo.setLastUseDeviceBrand(loginReq.getDeviceBrand()); + userInfo.setLastLoginIp(ipAddress); + String token = userInfoService.wechatlogin(userInfo); return Result.success(token); }