tj
10 天以前 add52b2fce633d62fb6cf829cc9ee58cb3727257
src/main/java/com/mzl/flower/web/login/CustomerLoginController.java
@@ -287,10 +287,11 @@
        }
        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("注册用户信息报错");
            }
@@ -330,7 +331,11 @@
            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("用户不存在");