Skip to content

Commit

Permalink
修复同一个邮箱有多条验证码时查询报错问题
Browse files Browse the repository at this point in the history
  • Loading branch information
atjiu committed May 24, 2019
1 parent 371d390 commit e1bdd49
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/co/yiiu/pybbs/service/CodeService.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

/**
* Created by tomoya.
Expand Down Expand Up @@ -59,7 +60,9 @@ public Code selectNotUsedCode(Integer userId, String email, String mobile) {
}
lambda.eq(Code::getUsed, false);
lambda.gt(Code::getExpireTime, new Date());
return codeMapper.selectOne(wrapper);
List<Code> codes = codeMapper.selectList(wrapper);
if (codes.isEmpty()) return null;
return codes.get(0);
}

// 创建一条验证码记录
Expand Down

0 comments on commit e1bdd49

Please sign in to comment.