release- 每日任务,每天只允许触发一次奖励

release-2024-04-25
pikaqiudeshujia 5 days ago
parent 8e99457934
commit c1ee460b9a

@ -21,14 +21,6 @@ import constants.ErrorConstants;
import constants.TaskPointIdConstants;
import dto.UserLoginDto;
import enums.PointEnums;
import java.io.IOException;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import exception.BizException;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
@ -41,6 +33,13 @@ import org.springframework.transaction.annotation.Transactional;
import util.IdWorker;
import util.JwtUtil;
import java.io.IOException;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* @program: luoo_parent
* @description:
@ -208,6 +207,14 @@ public class UserPointLogService {
}
}
// 对于日常任务,每天只允许完成一次,如果用户已经完成过,则直接返回,不重复添加积分
if (Objects.equals(type, PointEnums.TASK_TYPE_DAILY.getCode())) {
// 日常任务,每天只触发一次
if (userPointLogDao.findTodayByUserIdAndTaskPointId(userPointLog.getUserId(), userPointLog.getTaskPointId()) != null) {
return;
}
}
userPointLog.setScore(score);
userPointLog.setDescription(description);

Loading…
Cancel
Save