NutzCN Logo
问答 email和email_checked字段里面有值
发布于 2307天前 作者 qq_ebd02e3e 1306 次浏览 复制 上一个帖子 下一个帖子
标签:
    @At
    @AdaptBy(type=JsonAdaptor.class)
    @Ok("void")
    public void update(@Param("..")UserProfile profile, @Attr(scope=Scope.SESSION, value="me")int userId) {
        if (profile == null)
            return;
        profile.setUserId(userId);//修正userId,防止恶意修改其他用户的信息
        profile.setUpdateTime(new Date());
        profile.setAvatar(null); // 不准通过这个方法更新
        UserProfile old = get(userId);//profile。getEmail为用户传递过来的值,old.getEmail为数据库里原有的值
        // 检查email相关的更新
        if (old.getEmail() == null) {
            // 老的邮箱为null,所以新的肯定是未check的状态
            profile.setEmailChecked(false);
        } else {
            if (profile.getEmail() == null) {
                profile.setEmail(old.getEmail());
                profile.setEmailChecked(old.isEmailChecked());
            } else if (!profile.getEmail().equals(old.getEmail())) {
                // 设置新邮箱,果断设置为未检查状态
                profile.setEmailChecked(false);
            } else {
                profile.setEmailChecked(old.isEmailChecked());
            }
        }
        Daos.ext(dao, FieldFilter.create(UserProfile.class, null, "avatar", true)).update(profile);
    }
我什么都不输出  提交之后好像没有执行这一条  我的email和email_checked字段里面有值啊

if (profile.getEmail() == null) {
profile.setEmail(old.getEmail());
profile.setEmailChecked(old.isEmailChecked());

4 回复

debug一下就好了吧

@wendal 把 profile.getEmail() == null 改成 profile.getEmail().equals("")就好了
为什么Nutz-book 里面是 profile.getEmail() == null 我调过来就不行 jsp页面什么的都是cv的

写 Strings.isBlank(profile.getEmail()) 更好一些吧,至于为啥不行,可能是tomcat版本差异吧?

来自炫酷的 NutzCN

添加回复
请先登陆
回到顶部