1
zj
2024-06-03 09206aedcfdf30050123e99f2af0a192ebad1de4
src/main/java/com/nq/controller/UserApiController.java
@@ -54,24 +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("userPwd") String userPwd,
                              @RequestParam("email") String email,
                              @RequestParam("code") String code,
                              @RequestParam("phoneCode")String phoneCode,
                              HttpServletRequest httpServletRequest) {
        return this.iUserService.reg(agentCode, phone, userPwd, email,code,httpServletRequest);
}
        return this.iUserService.reg(agentCode, phone,phoneCode, userPwd,httpServletRequest);
    }
    @RequestMapping(value = {"sendMailCode.do"}, method = {RequestMethod.POST})
    @ResponseBody
    public ServerResponse sendMailCode(@RequestParam("toMail") String toMail) {
        return this.iUserService.sendMailCode(toMail);
    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})
@@ -87,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;
    }
@@ -113,17 +136,8 @@
    //找回密码
    @RequestMapping({"updatePwd.do"})
    @ResponseBody
    public ServerResponse updatePwd(@RequestParam("phoneNum") String phoneNum, @RequestParam("code") String code,@RequestParam("newPwd")  String newPwd) {
    public ServerResponse updatePwd(String phoneNum, String code, String newPwd) {
        return this.iUserService.updatePwd(phoneNum, code, newPwd);
    }
    //找回密码根据邮箱
    @RequestMapping({"retrievePasswordByEmail.do"})
    @ResponseBody
    public ServerResponse retrievePasswordByEmail(@RequestParam("email") String email,
                                                  @RequestParam("code") String code,
                                                  @RequestParam("newPwd") String newPwd) {
        return this.iUserService.retrievePasswordByEmail(email, code, newPwd);
    }
    /**