@At("/active/mail")
@POST
public Object activeMail(@Attr(scope=Scope.SESSION, value="me")int userId,
HttpServletRequest req) {
NutMap re = new NutMap();
UserProfile profile = get(userId);
if (Strings.isBlank(profile.getEmail())) {
return re.setv("ok", false).setv("msg", "你还没有填邮箱啊!");
}
String token = String.format("%s,%s,%s", userId, profile.getEmail(), System.currentTimeMillis());
token = Toolkit._3DES_encode(emailKEY, token.getBytes());
String url = req.getRequestURL() + "?token=" + token;
String html = "如果无法点击,请拷贝一下链接到浏览器中打开验证链接 %s";
html = String.format(html, url, url);
try {
boolean ok = emailService.send(profile.getEmail(), "XXX 验证邮件 by Nutzbook", html);
if (!ok) {
return re.setv("ok", false).setv("msg", "发送失败");
}
} catch (Throwable e) {
log.debug("发送邮件失败", e);
return re.setv("ok", false).setv("msg", "发送失败");
}
return re.setv("ok", true);
}
这段代码里的:UserProfile profile = get(userId);提示错误
The method get(int) is undefined for the type UserModule
这个应该如何处理
3 回复
dao.fetch一下即可
来自炫酷的 NutzCN
添加回复
请先登陆