优化修复会员签到记录,当天没有签到前一天已签到,连续签到却为0的bug的代码

This commit is contained in:
jason 2024-06-16 13:26:40 +08:00
parent 060bf5ec1e
commit 7af61a0000
1 changed files with 4 additions and 7 deletions

View File

@ -75,15 +75,12 @@ public class MemberSignInRecordServiceImpl implements MemberSignInRecordService
}
summary.setTodaySignIn(DateUtils.isToday(lastRecord.getCreateTime()));
// 4.1 校验今天是否签到没有签到则直接返回
if (!summary.getTodaySignIn()) {
// 4.1.1 如果是昨天设置连续签到天数
if(DateUtils.isYesterday(lastRecord.getCreateTime())){
summary.setContinuousDay(lastRecord.getDay());
};
// 4.1 检查今天是否未签到且记录不是昨天创建的如果是则直接返回
if (!summary.getTodaySignIn() && !DateUtils.isYesterday(lastRecord.getCreateTime())) {
return summary;
}
// 4.2 连续签到天数
// 4.2 要么是今天签到了要么是昨天的记录设置连续签到天数
summary.setContinuousDay(lastRecord.getDay());
return summary;
}