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 991882b..686c784 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 @@ -57,7 +57,7 @@ public class UserPointLogService { public UserPointLogService(UserPointLogDao userPointLogDao, IdWorker idWorker, JwtUtil jwtUtil, - TaskPointService taskPointService, TaskPointDao taskPointDao, RabbitTemplate rabbitTemplate, + TaskPointDao taskPointDao, RabbitTemplate rabbitTemplate, UserInfoService userInfoService) { this.userPointLogDao = userPointLogDao; this.idWorker = idWorker; @@ -78,10 +78,16 @@ public class UserPointLogService { */ public void addByTask(String taskPointId, String token) { - TaskPoint taskPoint = taskPointDao.findById(taskPointId).get(); - UserLoginDto userLoginDto = jwtUtil.getUserLoginDto(token); + // 新手任务,只触发一次 + if (!userPointLogDao.findUserPointLogByUserIdAndTaskPointId(userLoginDto.getUserId(), + taskPointId).isEmpty()) { + return; + } + + TaskPoint taskPoint = taskPointDao.findById(taskPointId).get(); + UserPointLog userPointLog = UserPointLog.builder() .id(String.valueOf(idWorker.nextId())) .score(taskPoint.getScore()) @@ -143,7 +149,8 @@ public class UserPointLogService { * @param size 每页数量 * @return 用户积分列表 */ - public PageResult getUserPointLogList(String token, UserPointLogSearchDto userPointLogSearchDto, Integer page, + public PageResult getUserPointLogList(String token, + UserPointLogSearchDto userPointLogSearchDto, Integer page, Integer size) { // UserLoginDto userLoginDto = jwtUtil.getUserLoginDto(token);