From c1ee460b9ac87d35c7488b112567535731e0d7cc Mon Sep 17 00:00:00 2001 From: pikaqiudeshujia Date: Tue, 19 Nov 2024 08:11:49 +0800 Subject: [PATCH] =?UTF-8?q?release-=20=E6=AF=8F=E6=97=A5=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=EF=BC=8C=E6=AF=8F=E5=A4=A9=E5=8F=AA=E5=85=81=E8=AE=B8=E8=A7=A6?= =?UTF-8?q?=E5=8F=91=E4=B8=80=E6=AC=A1=E5=A5=96=E5=8A=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user/service/UserPointLogService.java | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/luoo_user/src/main/java/com/luoo/user/service/UserPointLogService.java b/luoo_user/src/main/java/com/luoo/user/service/UserPointLogService.java index fdf4749..386e34e 100644 --- a/luoo_user/src/main/java/com/luoo/user/service/UserPointLogService.java +++ b/luoo_user/src/main/java/com/luoo/user/service/UserPointLogService.java @@ -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);