1
zj
2024-05-22 e178d78da637bb469b2919f957d94219bc59d618
src/main/java/com/nq/controller/UserApiController.java
@@ -54,13 +54,47 @@
    @Autowired
    ISiteSpreadService iSiteSpreadService;
    //注册
    @RequestMapping(value = {"reg.do"}, method = {RequestMethod.POST})
    @ResponseBody
    public ServerResponse reg(@RequestParam("agentCode") String agentCode, @RequestParam("phone") String phone, @RequestParam(value = "yzmCode", defaultValue = "") String yzmCode, @RequestParam("userPwd") String userPwd, HttpServletRequest httpServletRequest) {
        return this.iUserService.reg(yzmCode, agentCode, phone, userPwd, httpServletRequest);
}
    public ServerResponse reg(@RequestParam("agentCode") String agentCode,
                              @RequestParam("phone") String phone,
                              @RequestParam("phoneCode") String phoneCode,
                              @RequestParam("userPwd") String userPwd,
                              HttpServletRequest httpServletRequest) {
        return this.iUserService.reg(agentCode, phone,phoneCode, userPwd,httpServletRequest);
    }
    @RequestMapping(value = {"sendMailCode.do"}, method = {RequestMethod.POST})
    @ResponseBody
    public ServerResponse sendMailCode(@RequestParam("email") String email) {
        try {
            if (email == null || email.isEmpty()) { // 判断email参数是否为空
                return ServerResponse.createByErrorMsg("邮箱不能为空");
            }
            log.info("-------->发送邮件");
            return this.iUserService.sendMailCode(email);
        } catch (Exception e) {
            e.printStackTrace();
            return ServerResponse.createByErrorMsg("发送失败,发生异常");
        }
    }
    @RequestMapping(value = {"sendSms.do"}, method = {RequestMethod.POST})
    @ResponseBody
    public ServerResponse sendSms(@RequestParam("phone") String phone,HttpServletRequest request) {
        try {
            if (phone == null || phone.isEmpty()) {
                return ServerResponse.createByErrorMsg("手机号不能为空",request);
            }
            log.info("-------->发送短信");
            return this.iUserService.sendSms(phone,request);
        } catch (Exception e) {
            e.printStackTrace();
            return ServerResponse.createByErrorMsg("发送失败,发生异常");
        }
    }
    //登录
    @RequestMapping(value = {"login.do"}, method = {RequestMethod.POST})
@@ -76,7 +110,7 @@
            UserLoginResultVO resultVO = new UserLoginResultVO();
            resultVO.setKey(pc_cookie_name);
            resultVO.setToken(token);
            return ServerResponse.createBySuccess("Login Success", resultVO);
            return ServerResponse.createBySuccess("登录成功", resultVO);
        }
        return serverResponse;
    }