diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/common/gift/GameLuckyGiftCommon.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/common/gift/GameLuckyGiftCommon.java index bbc5db5b..7eeb8f9a 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/common/gift/GameLuckyGiftCommon.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/common/gift/GameLuckyGiftCommon.java @@ -12,6 +12,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.red.circle.common.business.core.enums.SysOriginPlatformEnum; import com.red.circle.component.mq.MessageEvent; import com.red.circle.component.mq.service.FixedTopic; +import com.red.circle.component.redis.service.RedisService; import com.red.circle.external.inner.endpoint.message.ImGroupClient; import com.red.circle.external.inner.model.cmd.message.BroadcastGroupMsgBodyCmd; import com.red.circle.external.inner.model.cmd.message.CustomGroupMsgBodyCmd; @@ -35,6 +36,7 @@ import com.red.circle.other.app.dto.cmd.task.RoomDailyTaskProgressUpdateCmd; import com.red.circle.other.app.service.activity.ActivityRechargeTicketService; import com.red.circle.other.app.service.activity.RankingActivityService; import com.red.circle.other.app.service.task.RoomDailyTaskProgressService; +import com.red.circle.other.app.util.DateTimeAsiaRiyadhUtils; import com.red.circle.other.domain.gateway.user.UserProfileGateway; import com.red.circle.other.domain.ranking.RankingActivityType; import com.red.circle.other.domain.ranking.RankingCycleType; @@ -83,6 +85,7 @@ import java.math.BigDecimal; import java.math.RoundingMode; import java.security.MessageDigest; import java.util.*; +import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import lombok.Data; import lombok.RequiredArgsConstructor; @@ -121,6 +124,7 @@ public class GameLuckyGiftCommon { private final ActivityRechargeTicketService activityRechargeTicketService; private final RoomDailyTaskProgressService roomDailyTaskProgressService; private final RoomMemberService roomMemberService; + private final RedisService redisService; /** * 发送幸运礼物抽奖mq. @@ -282,11 +286,15 @@ public class GameLuckyGiftCommon { return; } + String redisKey = "room:daily:task:progress:" + taskType.name() + ":" + param.getUserId() + ":" + ZonedDateTimeAsiaRiyadhUtils.now().toLocalDate(); + Long total = redisService.increment(redisKey, rewardAmount); + redisService.expire(redisKey, DateTimeAsiaRiyadhUtils.getSecondsUntilMidnight(), TimeUnit.SECONDS); + roomDailyTaskProgressService.updateTaskProgress( new RoomDailyTaskProgressUpdateCmd() .setUserId(param.getUserId()) .setTaskCode(taskType.name()) - .setProgressValue(rewardAmount.intValue()) + .setProgressValue(total.intValue()) ); } diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/gift/strategy/GiftCountStrategy.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/gift/strategy/GiftCountStrategy.java index a18d8ac0..c5dbbc61 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/gift/strategy/GiftCountStrategy.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/gift/strategy/GiftCountStrategy.java @@ -231,7 +231,7 @@ public class GiftCountStrategy implements GiftStrategy { long actualAmount = getActualAmount(runningWater.getGiftValue(), runningWater.getGiftValue().getActualAmount()); // 给用户送礼 - if (!roomMember.getUserId().equals(userId)) { + if (!roomProfile.getUserId().equals(userId)) { handleSendGiftTask(userId, acceptUserIds, RoomDailyTaskCode.PERSONAL_SEND_GIFT); }