use of cn.dubidubi.model.json.MailBindResult in project dubidubi by lzzzz4.
the class MailController method mailConfirm.
/**
* @Description: 发送邮箱验证码
* @data :@param mailFromWxDTO
* @data :@param request
* @data :@return
* @date :2018年3月9日下午8:44:34
*/
@RequestMapping("/mailConfirm")
@ResponseBody
public MailBindResult mailConfirm(MailFromWxDTO mailFromWxDTO, HttpServletRequest request) {
MailBindResult mailBindResult = new MailBindResult();
MailDTO dto = new MailDTO();
String code = MailUtils.randomSecurityCode();
dto.setContent(code);
dto.setMail(mailFromWxDTO.getMail());
dto.setTitle("欢迎绑定邮箱");
request.getSession().setAttribute("code", code);
LoggerFactory.getLogger(this.getClass()).info("开始绑定邮箱:" + mailFromWxDTO.getMail());
// 将正确的验证码放入对象
MailUtils.sendMail(dto);
System.out.println("验证码为" + code);
mailBindResult.setResult(code);
return mailBindResult;
}
use of cn.dubidubi.model.json.MailBindResult in project dubidubi by lzzzz4.
the class MailController method addMail.
/**
* @Description: 增加邮箱
* @data :@return
* @date :2018年3月10日上午11:56:58
*/
@RequestMapping("/addMail")
@ResponseBody
public MailBindResult addMail(MailInfo mailInfo, HttpServletRequest request) {
MailBindResult mailBindResult = new MailBindResult();
// 储存邮箱
WxInfoDTO wxInfoDTO = (WxInfoDTO) request.getSession().getAttribute("user");
mailInfo.setCreateTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
mailInfo.setNickName(wxInfoDTO.getNickname());
mailInfo.setOpenId(wxInfoDTO.getOpenid());
mailInfo.setPicUrl(wxInfoDTO.getHeadimgurl());
mailService.saveOneMail(mailInfo);
mailBindResult.setResult("200");
return mailBindResult;
}
Aggregations