发表于: 2018-09-09 22:41:48
1 508
今天完成的事情:
代码整理,准备提交任务;
看了下任务8
明天计划的事情:
任务总结,深度思考
遇到的问题:
服务器要买新的,等我弟的学生账号,然后交任务;
等了好久,服务器买好了,不知道为什么最近阿里云官网好卡
收获:
1、代码中已有的手机号、邮箱注册;然后增加相对应的手机号、邮箱绑定
在请假之前,做的就是绑定,所以进行修改;
获取验证码的接口不用修改;主要增加验证的接口
邮箱绑定:
@RequestMapping(value = "/emailBind", method = RequestMethod.GET)
public ModelAndView checkEmail(ModelAndView modelAndView, HttpServletRequest request, Result result, People people) throws UnsupportedEncodingException {
logger.info("checkEmail:参数:" + people.toString());
String email = request.getParameter("email");
String randCode = request.getParameter("randCode");
String name = request.getParameter("name");
//查询数据库,验证码对比
if (emailUtil.checkEmail(randCode, name)) {
logger.info("success");
//更新数据库
people.setEmail(email);
people.setUpdateTime(System.currentTimeMillis());
userService.updatePeople(people);
result.setMsg("验证成功");
modelAndView.setViewName("forward:u/showPeople1");
return modelAndView;
}
logger.info("fail");
result.setMsg("验证失败");
modelAndView.setViewName("redirect:skipEmail");
return modelAndView;
}
手机号绑定:
@RequestMapping(value = "/peopleTel", method = RequestMethod.POST)
public String addTel(People people, HttpServletRequest request, Result result) {
logger.info("addTel:参数people:" + people.toString());
logger.info("addTel:参数randCode:" + request.getParameter("rand_Code"));
long tel = Long.valueOf(request.getParameter("tel"));
//查询数据库,验证码对比
if (noteUtil.checkRandCode(request.getParameter("rand_Code"), tel)) {
people.setUpdateTime(System.currentTimeMillis());
//更新数据库
userService.updatePeople(people);
result.setCode(0);
result.setMsg("绑定成功");
} else {
result.setCode(-103);
result.setMsg("绑定失败");
}
return "json";
}
其中,因为邮箱验证中html中的url不一样,所以emailUtil中的发送邮件的方法增加参数emailType(对应邮箱绑定或注册)
public boolean sentEmail(HttpServletRequest request, String randCode,String emailType) {
2、spring RMI跑了个简单的demo,按照教程能跑通,能理解远程调用的意思,但是具体的代码实现还未理解;
等交了任务,拆禅道,任务八开始
评论