puzhibing
2023-05-18 c54be562403989ae722ce4e12b640d4a44b5dcb3
UserZYTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java
@@ -134,6 +134,42 @@
    }
    /**
     * 获取短信验证码
     * @param phone
     * @return
     */
    @ResponseBody
    @PostMapping("/base/queryCaptcha1")
    @ApiOperation(value = "获取短信验证码", tags = {"用户端-分享"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "手机号码", name = "phone", required = true, dataType = "String"),
            @ApiImplicitParam(value = "场景类型(1=身份验证,2=登录确认,3=用户注册,4=修改密码)", name = "type", required = true, dataType = "String")
    })
    public ResultUtil queryCaptcha1(String phone, Integer type){
        if(ToolUtil.isNotEmpty(phone)){
            try {
               /* HttpSession session = request.getSession();
                String code = (String)session.getAttribute(Constants.KAPTCHA_SESSION_KEY);*/
//                String code = redisUtil.getValue(phone+"_Code");
//                System.out.println("缓存中验证码为:"+code);
//                if (ToolUtil.isEmpty(kaptcha) || !kaptcha.equalsIgnoreCase(code)) {
//                    return ResultUtil.error("图形验证码错误");
//                }
                return userInfoService.queryCaptcha(phone, type);
            }catch (Exception e){
                e.printStackTrace();
                return ResultUtil.runErr();
            }
        }else{
            return ResultUtil.paranErr();
        }
    }
    /**
     * 手机验证码登录
     * @param phone
@@ -180,6 +216,10 @@
    })
    public ResultUtil<LoginWarpper> captchaLogin_(String phone, String code, Integer uid, Integer type, Integer userType){
        try {
            UserInfo userInfo = userInfoService.queryByPhone(phone);
            if(null != userInfo){
                return ResultUtil.error("手机号已注册");
            }
            return userInfoService.captchaLogin(phone, code, uid, type, userType);
        }catch (Exception e){
            e.printStackTrace();