1
zhujie
4 天以前 ec15861e14c66c38b1a8f5fffc6975d7da6c315c
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("注册用户信息报错");
            }
@@ -316,6 +317,10 @@
                throw new ValidationException("用户已禁用,请联系管理员");
            }
            //验证邀请码
            if (StringUtils.isNotEmpty(loginDTO.getIntevailCode())) {
                throw new ValidationException("非新用户注册无法填写邀请码,请删除后重新登陆");
            }
            tokenCache = stringCacheClient.get(TOKEN_KEY + SEPARATOR + user.getId());
            if (StringUtils.isNotBlank(tokenCache))  {
@@ -330,7 +335,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("用户不存在");