| | |
| | | } |
| | | |
| | | User user = userService.findByTel(tel, Constants.USER_TYPE.customer.name()); |
| | | User user1 = null; |
| | | String tokenCache =""; |
| | | if(user == null){ |
| | | loginDTO.setUserType(Constants.USER_TYPE.customer.name()); |
| | | User user1 = userService.registPhoneUser(loginDTO); |
| | | user1 = userService.registPhoneUser(loginDTO); |
| | | if(org.springframework.util.StringUtils.isEmpty(user1)){ |
| | | throw new ValidationException("注册用户信息报错"); |
| | | } |
| | |
| | | OAuth2AccessToken token = loginService.getAccessToken(authentication, Constants.USER_TYPE.customer.name()); |
| | | //删除缓存中的验证码 |
| | | stringCacheClient.delete(SMS_CODE_KEY + SEPARATOR + Constants.USER_TYPE.customer.name() + SEPARATOR + tel); |
| | | stringCacheClient.set(TOKEN_KEY + SEPARATOR + user.getId(),token.getValue()); |
| | | if(user == null){ |
| | | stringCacheClient.set(TOKEN_KEY + SEPARATOR + user1.getId(),token.getValue()); |
| | | }else { |
| | | stringCacheClient.set(TOKEN_KEY + SEPARATOR + user.getId(), token.getValue()); |
| | | } |
| | | return returnData(R.SUCCESS.getCode(),token); |
| | | }catch (UsernameNotFoundException e){ |
| | | throw new ValidationException("用户不存在"); |