房间金币大放送新增roomMember逻辑

This commit is contained in:
tianfeng 2026-03-05 17:08:37 +08:00
parent 0958146a18
commit 1640830664
7 changed files with 122 additions and 26 deletions

View File

@ -13,14 +13,17 @@ import com.red.circle.live.infra.database.mongo.service.LiveMicSettingService;
import com.red.circle.live.infra.util.DateTimeAsiaRiyadhUtils; import com.red.circle.live.infra.util.DateTimeAsiaRiyadhUtils;
import com.red.circle.live.inner.error.LiveMicErrorCode; import com.red.circle.live.inner.error.LiveMicErrorCode;
import com.red.circle.other.inner.endpoint.live.RoomManagerClient; import com.red.circle.other.inner.endpoint.live.RoomManagerClient;
import com.red.circle.other.inner.endpoint.live.RoomMemberClient;
import com.red.circle.other.inner.endpoint.task.RoomDailyTaskClient; import com.red.circle.other.inner.endpoint.task.RoomDailyTaskClient;
import com.red.circle.other.inner.enums.task.RoomDailyTaskCode; import com.red.circle.other.inner.enums.task.RoomDailyTaskCode;
import com.red.circle.other.inner.model.cmd.task.RoomDailyTaskProgressUpdateInnerCmd; import com.red.circle.other.inner.model.cmd.task.RoomDailyTaskProgressUpdateInnerCmd;
import com.red.circle.other.inner.model.dto.live.RoomMemberDTO;
import com.red.circle.other.inner.model.dto.live.RoomProfileDTO; import com.red.circle.other.inner.model.dto.live.RoomProfileDTO;
import com.red.circle.tool.core.date.ZonedDateTimeAsiaRiyadhUtils; import com.red.circle.tool.core.date.ZonedDateTimeAsiaRiyadhUtils;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Objects; import java.util.Objects;
@ -45,6 +48,8 @@ public class LiveMicGoUpCmdExe {
private final RedisService redisService; private final RedisService redisService;
private final RoomDailyTaskClient roomDailyTaskClient; private final RoomDailyTaskClient roomDailyTaskClient;
private final RoomManagerClient roomManagerClient; private final RoomManagerClient roomManagerClient;
private final RedisTemplate redisTemplate;
private final RoomMemberClient roomMemberClient;
public LiveMicrophoneCO execute(MicUpDownCmd cmd) { public LiveMicrophoneCO execute(MicUpDownCmd cmd) {
checkPermissions(cmd); checkPermissions(cmd);
@ -64,6 +69,7 @@ public class LiveMicGoUpCmdExe {
} }
//notice.setRoomToken(createAgoraTokenGoUp(cmd)); //notice.setRoomToken(createAgoraTokenGoUp(cmd));
// 房主邀请成员上麦
handleRoomDailyTask(cmd); handleRoomDailyTask(cmd);
return notice; return notice;
@ -71,26 +77,40 @@ public class LiveMicGoUpCmdExe {
private void handleRoomDailyTask(MicUpDownCmd cmd) { private void handleRoomDailyTask(MicUpDownCmd cmd) {
try { try {
RoomProfileDTO roomProfile = roomManagerClient.getById(cmd.getRoomId()).getBody();
if (Objects.isNull(roomProfile)) {
return;
}
RoomMemberDTO roomMemberDTO = roomMemberClient.getMember(cmd.getRoomId(), cmd.getReqUserId()).getBody();
if (Objects.isNull(roomMemberDTO)) {
return;
}
boolean invite = cmd.eventTypeEqInvite(); boolean invite = cmd.eventTypeEqInvite();
if (invite) { if (invite && Objects.equals(roomProfile.getUserId(), cmd.getInviterId())) {
RoomProfileDTO roomProfile = roomManagerClient.getById(cmd.getRoomId()).getBody();
Long roomOwnerId = roomProfile.getUserId(); Long roomOwnerId = roomProfile.getUserId();
handleInviteMicTask(roomOwnerId, RoomDailyTaskCode.ROOM_OWNER_INVITE_MIC); handleInviteMicTask(roomOwnerId, cmd.requiredReqUserId(), RoomDailyTaskCode.ROOM_OWNER_INVITE_MIC);
} }
} catch (Exception exception){ } catch (Exception exception){
log.error("handleRoomDailyTask exception: {}", exception.getMessage()); log.error("handleRoomDailyTask exception: {}", exception.getMessage());
} }
} }
private void handleInviteMicTask(Long roomOwnerId, RoomDailyTaskCode taskCode) { private void handleInviteMicTask(Long roomOwnerId, Long userId, RoomDailyTaskCode taskCode) {
String redisKey = "room:daily:task:progress:" + taskCode.name() + ":" + roomOwnerId + ":" + ZonedDateTimeAsiaRiyadhUtils.now().toLocalDate(); String setKey = "room:daily:task:progress:" + taskCode.name() + ":" + roomOwnerId + ":" + ZonedDateTimeAsiaRiyadhUtils.now().toLocalDate();
Long total = redisService.increment(redisKey, 1); Long added = redisTemplate.opsForSet().add(setKey, userId);
redisService.expire(redisKey, DateTimeAsiaRiyadhUtils.getSecondsUntilMidnight(), TimeUnit.SECONDS); redisService.expire(setKey, DateTimeAsiaRiyadhUtils.getSecondsUntilMidnight(), TimeUnit.SECONDS);
if (!Long.valueOf(1L).equals(added)) {
return;
}
int uniqueCount = (int) redisService.setSize(setKey);
roomDailyTaskClient.updateTaskProgress( roomDailyTaskClient.updateTaskProgress(
new RoomDailyTaskProgressUpdateInnerCmd() new RoomDailyTaskProgressUpdateInnerCmd()
.setUserId(roomOwnerId) .setUserId(roomOwnerId)
.setTaskCode(taskCode.name()) .setTaskCode(taskCode.name())
.setProgressValue(total.intValue()) .setProgressValue(uniqueCount)
); );
} }

View File

@ -7,6 +7,7 @@ import com.red.circle.component.mq.service.Action;
import com.red.circle.component.mq.service.ConsumerMessage; import com.red.circle.component.mq.service.ConsumerMessage;
import com.red.circle.component.mq.service.MessageListener; import com.red.circle.component.mq.service.MessageListener;
import com.red.circle.component.redis.service.RedisService; import com.red.circle.component.redis.service.RedisService;
import com.red.circle.framework.dto.ResultResponse;
import com.red.circle.live.app.dto.cmd.HeartbeatStatusEnum; import com.red.circle.live.app.dto.cmd.HeartbeatStatusEnum;
import com.red.circle.live.domain.gateway.LiveMicrophoneGateway; import com.red.circle.live.domain.gateway.LiveMicrophoneGateway;
import com.red.circle.live.domain.live.LiveMicrophone; import com.red.circle.live.domain.live.LiveMicrophone;
@ -19,12 +20,14 @@ import com.red.circle.mq.business.model.event.user.UserHeartbeatEvent;
import com.red.circle.mq.rocket.business.producer.UserMqMessageService; import com.red.circle.mq.rocket.business.producer.UserMqMessageService;
import com.red.circle.mq.rocket.business.streams.UserHeartbeatSink; import com.red.circle.mq.rocket.business.streams.UserHeartbeatSink;
import com.red.circle.other.inner.endpoint.live.RoomManagerClient; import com.red.circle.other.inner.endpoint.live.RoomManagerClient;
import com.red.circle.other.inner.endpoint.live.RoomMemberClient;
import com.red.circle.other.inner.endpoint.task.RoomDailyTaskClient; import com.red.circle.other.inner.endpoint.task.RoomDailyTaskClient;
import com.red.circle.other.inner.endpoint.user.user.UserOnlineClient; import com.red.circle.other.inner.endpoint.user.user.UserOnlineClient;
import com.red.circle.other.inner.endpoint.user.user.UserProfileClient; import com.red.circle.other.inner.endpoint.user.user.UserProfileClient;
import com.red.circle.other.inner.enums.task.RoomDailyTaskCode; import com.red.circle.other.inner.enums.task.RoomDailyTaskCode;
import com.red.circle.other.inner.model.cmd.task.RoomDailyTaskProgressUpdateInnerCmd; import com.red.circle.other.inner.model.cmd.task.RoomDailyTaskProgressUpdateInnerCmd;
import com.red.circle.other.inner.model.cmd.user.OnlineStatusUploadCmd; import com.red.circle.other.inner.model.cmd.user.OnlineStatusUploadCmd;
import com.red.circle.other.inner.model.dto.live.RoomMemberDTO;
import com.red.circle.other.inner.model.dto.live.RoomProfileDTO; import com.red.circle.other.inner.model.dto.live.RoomProfileDTO;
import com.red.circle.other.inner.model.dto.user.UserProfileDTO; import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
import com.red.circle.tool.core.collection.CollectionUtils; import com.red.circle.tool.core.collection.CollectionUtils;
@ -65,6 +68,7 @@ public class UserHeartbeatListener implements MessageListener {
private final LiveMicUserCacheService liveMicUserCacheService; private final LiveMicUserCacheService liveMicUserCacheService;
private final RoomDailyTaskClient roomDailyTaskClient; private final RoomDailyTaskClient roomDailyTaskClient;
private final RedisService redisService; private final RedisService redisService;
private final RoomMemberClient roomMemberClient;
private static final int HEARTBEAT_INTERVAL_SECONDS = 60; private static final int HEARTBEAT_INTERVAL_SECONDS = 60;
@ -139,6 +143,12 @@ public class UserHeartbeatListener implements MessageListener {
} }
private void updateDailyTask(Long roomId, Long userId, RoomDailyTaskCode taskType) { private void updateDailyTask(Long roomId, Long userId, RoomDailyTaskCode taskType) {
ResultResponse<RoomMemberDTO> response = roomMemberClient.getMember(roomId, userId);
RoomMemberDTO roomMemberDTO = response.getBody();
if (!response.checkSuccess() || roomMemberDTO == null) {
return;
}
String redisKey = "room:daily:task:progress:" + taskType.name() + ":" + userId + ":" + ZonedDateTimeAsiaRiyadhUtils.now().toLocalDate(); String redisKey = "room:daily:task:progress:" + taskType.name() + ":" + userId + ":" + ZonedDateTimeAsiaRiyadhUtils.now().toLocalDate();
Long total = redisService.increment(redisKey, 1); Long total = redisService.increment(redisKey, 1);
redisService.expire(redisKey, DateTimeAsiaRiyadhUtils.getSecondsUntilMidnight(), TimeUnit.SECONDS); redisService.expire(redisKey, DateTimeAsiaRiyadhUtils.getSecondsUntilMidnight(), TimeUnit.SECONDS);

View File

@ -33,6 +33,11 @@ public class MicUpDownCmd extends AppExtCommand {
@NotNull(message = "mickIndex required.") @NotNull(message = "mickIndex required.")
private Integer mickIndex; private Integer mickIndex;
/**
* 邀请人ID
*/
private Long inviterId;
/** /**
* 事件类型. * 事件类型.
*/ */

View File

@ -31,6 +31,8 @@ import com.red.circle.other.infra.database.mongo.entity.live.RoomSetting;
import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService; import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService;
import com.red.circle.other.infra.database.mongo.service.live.RoomTouristService; import com.red.circle.other.infra.database.mongo.service.live.RoomTouristService;
import com.red.circle.other.infra.database.mongo.service.live.RoomUserBlacklistService; import com.red.circle.other.infra.database.mongo.service.live.RoomUserBlacklistService;
import com.red.circle.other.infra.database.rds.entity.live.RoomMember;
import com.red.circle.other.infra.database.rds.service.live.RoomMemberService;
import com.red.circle.other.infra.database.rds.service.props.PropsRoomLockService; import com.red.circle.other.infra.database.rds.service.props.PropsRoomLockService;
import com.red.circle.other.infra.database.rds.service.sys.AdministratorAuthService; import com.red.circle.other.infra.database.rds.service.sys.AdministratorAuthService;
import com.red.circle.other.infra.database.rds.service.sys.AdministratorService; import com.red.circle.other.infra.database.rds.service.sys.AdministratorService;
@ -92,6 +94,7 @@ public class RoomEnterCmdExe {
private final RoomDailyTaskProgressService roomDailyTaskProgressService; private final RoomDailyTaskProgressService roomDailyTaskProgressService;
private final RedisService redisService; private final RedisService redisService;
private final RedisTemplate redisTemplate; private final RedisTemplate redisTemplate;
private final RoomMemberService roomMemberService;
public EntryRoomResponseCO execute(RoomEntryCmd cmd) { public EntryRoomResponseCO execute(RoomEntryCmd cmd) {
//checkEntryUserId(cmd); //checkEntryUserId(cmd);
@ -135,7 +138,7 @@ public class RoomEnterCmdExe {
} }
// 房间每日任务 // 房间每日任务
updateRoomDailyTask(cmd.getReqUserId(), manager.getUserId()); updateRoomDailyTask(cmd.getReqUserId(), manager.getUserId(), manager.getId());
return new EntryRoomResponseCO() return new EntryRoomResponseCO()
.setRoomProfile( .setRoomProfile(
@ -161,16 +164,25 @@ public class RoomEnterCmdExe {
); );
} }
private void updateRoomDailyTask(Long enterUserId, Long roomOwnerId) { private void updateRoomDailyTask(Long enterUserId, Long roomOwnerId, Long roomId) {
// 只处理用户进入非自己房间的情况 // 只处理用户进入非自己房间的情况
if (Objects.equals(enterUserId, roomOwnerId)) { if (Objects.equals(enterUserId, roomOwnerId)) {
return; return;
} }
try { RoomMember roomMember = roomMemberService.getRoomMember(roomId, enterUserId);
if (Objects.isNull(roomMember)) {
return;
}
try {
// Redis 去重同一用户当天进入同一房间只计一次 // Redis 去重同一用户当天进入同一房间只计一次
String redisKey = "room:daily:task:new_member:" + roomOwnerId + ":" + ZonedDateTimeAsiaRiyadhUtils.now().toLocalDate(); String redisKey = "room:daily:task:new_member:" + roomOwnerId + ":" + ZonedDateTimeAsiaRiyadhUtils.now().toLocalDate();
redisTemplate.opsForSet().add(redisKey, enterUserId); Long added = redisTemplate.opsForSet().add(redisKey, enterUserId);
redisService.expire(redisKey, DateTimeAsiaRiyadhUtils.getSecondsUntilMidnight(), TimeUnit.SECONDS); redisService.expire(redisKey, DateTimeAsiaRiyadhUtils.getSecondsUntilMidnight(), TimeUnit.SECONDS);
if (!Long.valueOf(1L).equals(added)) {
return;
}
long uniqueCount = redisService.setSize(redisKey); long uniqueCount = redisService.setSize(redisKey);
roomDailyTaskProgressService.updateTaskProgress( roomDailyTaskProgressService.updateTaskProgress(

View File

@ -15,6 +15,8 @@ import com.red.circle.other.infra.database.mongo.entity.team.team.TeamMemberTarg
import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService; import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService;
import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberService; import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberService;
import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberTargetService; import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberTargetService;
import com.red.circle.other.infra.database.rds.entity.live.RoomMember;
import com.red.circle.other.infra.database.rds.service.live.RoomMemberService;
import com.red.circle.other.infra.database.rds.service.sys.AdministratorService; import com.red.circle.other.infra.database.rds.service.sys.AdministratorService;
import com.red.circle.other.inner.asserts.RoomErrorCode; import com.red.circle.other.inner.asserts.RoomErrorCode;
@ -50,6 +52,7 @@ public class TeamMemberHeartbeatCmdExe {
private final TaskService taskService; private final TaskService taskService;
private final RedisService redisService; private final RedisService redisService;
private final RoomDailyTaskProgressService roomDailyTaskProgressService; private final RoomDailyTaskProgressService roomDailyTaskProgressService;
private final RoomMemberService roomMemberService;
private static final int HEARTBEAT_INTERVAL_SECONDS = 60; private static final int HEARTBEAT_INTERVAL_SECONDS = 60;
@ -103,6 +106,11 @@ public class TeamMemberHeartbeatCmdExe {
} }
private void updateDailyTask(AppRoomIdCmd cmd, RoomDailyTaskCode taskType) { private void updateDailyTask(AppRoomIdCmd cmd, RoomDailyTaskCode taskType) {
RoomMember roomMember = roomMemberService.getRoomMember(cmd.getRoomId(), cmd.requiredReqUserId());
if (roomMember == null) {
return;
}
Long userId = cmd.requiredReqUserId(); Long userId = cmd.requiredReqUserId();
String redisKey = "room:daily:task:progress:" + taskType.name() + ":" + userId + ":" + ZonedDateTimeAsiaRiyadhUtils.now().toLocalDate(); String redisKey = "room:daily:task:progress:" + taskType.name() + ":" + userId + ":" + ZonedDateTimeAsiaRiyadhUtils.now().toLocalDate();
Long total = redisService.increment(redisKey, 1); Long total = redisService.increment(redisKey, 1);
@ -153,6 +161,15 @@ public class TeamMemberHeartbeatCmdExe {
* 统计用户在房间的麦位时长到达30/60/120分钟时更新房主任务进度 * 统计用户在房间的麦位时长到达30/60/120分钟时更新房主任务进度
*/ */
private void updateRoomMicUserDurationTask(Long userId, Long roomOwnerId, Long roomId) { private void updateRoomMicUserDurationTask(Long userId, Long roomOwnerId, Long roomId) {
if (roomOwnerId.equals(userId)) {
return;
}
RoomMember roomMember = roomMemberService.getRoomMember(roomId, userId);
if (roomMember == null) {
return;
}
String redisKey = "room:daily:task:mic_duration:" + roomId + ":" + userId + ":" + ZonedDateTimeAsiaRiyadhUtils.now().toLocalDate(); String redisKey = "room:daily:task:mic_duration:" + roomId + ":" + userId + ":" + ZonedDateTimeAsiaRiyadhUtils.now().toLocalDate();
Long minutes = redisService.increment(redisKey, 1); Long minutes = redisService.increment(redisKey, 1);
redisService.expire(redisKey, DateTimeAsiaRiyadhUtils.getSecondsUntilMidnight(), TimeUnit.SECONDS); redisService.expire(redisKey, DateTimeAsiaRiyadhUtils.getSecondsUntilMidnight(), TimeUnit.SECONDS);

View File

@ -51,10 +51,12 @@ import com.red.circle.other.infra.database.rds.entity.game.GameLuckyGiftCount;
import com.red.circle.other.infra.database.rds.entity.game.GameLuckyGiftRuleConfig; import com.red.circle.other.infra.database.rds.entity.game.GameLuckyGiftRuleConfig;
import com.red.circle.other.infra.database.rds.entity.game.LuckyGiftProbability; import com.red.circle.other.infra.database.rds.entity.game.LuckyGiftProbability;
import com.red.circle.other.infra.database.rds.entity.game.LuckyGiftProbabilityDetails; import com.red.circle.other.infra.database.rds.entity.game.LuckyGiftProbabilityDetails;
import com.red.circle.other.infra.database.rds.entity.live.RoomMember;
import com.red.circle.other.infra.database.rds.service.game.GameLuckyGiftCountService; import com.red.circle.other.infra.database.rds.service.game.GameLuckyGiftCountService;
import com.red.circle.other.infra.database.rds.service.game.GameLuckyGiftRuleConfigService; import com.red.circle.other.infra.database.rds.service.game.GameLuckyGiftRuleConfigService;
import com.red.circle.other.infra.database.rds.service.game.LuckyGiftProbabilityDetailsService; import com.red.circle.other.infra.database.rds.service.game.LuckyGiftProbabilityDetailsService;
import com.red.circle.other.infra.database.rds.service.game.LuckyGiftProbabilityService; import com.red.circle.other.infra.database.rds.service.game.LuckyGiftProbabilityService;
import com.red.circle.other.infra.database.rds.service.live.RoomMemberService;
import com.red.circle.other.infra.database.rds.service.sys.EnumConfigService; import com.red.circle.other.infra.database.rds.service.sys.EnumConfigService;
import com.red.circle.other.inner.enums.config.EnumConfigKey; import com.red.circle.other.inner.enums.config.EnumConfigKey;
import com.red.circle.other.inner.enums.game.luckgift.GameLuckyGiftModeEnum; import com.red.circle.other.inner.enums.game.luckgift.GameLuckyGiftModeEnum;
@ -118,6 +120,7 @@ public class GameLuckyGiftCommon {
private final GiftAppConvertor giftAppConvertor; private final GiftAppConvertor giftAppConvertor;
private final ActivityRechargeTicketService activityRechargeTicketService; private final ActivityRechargeTicketService activityRechargeTicketService;
private final RoomDailyTaskProgressService roomDailyTaskProgressService; private final RoomDailyTaskProgressService roomDailyTaskProgressService;
private final RoomMemberService roomMemberService;
/** /**
* 发送幸运礼物抽奖mq. * 发送幸运礼物抽奖mq.
@ -274,6 +277,11 @@ public class GameLuckyGiftCommon {
} }
private void updateRoomDailyTask(GameLuckyGiftParam param, Long rewardAmount, RoomDailyTaskCode taskType) { private void updateRoomDailyTask(GameLuckyGiftParam param, Long rewardAmount, RoomDailyTaskCode taskType) {
RoomMember roomMember = roomMemberService.getRoomMember(param.getRoomId(), param.getUserId());
if (roomMember == null) {
return;
}
roomDailyTaskProgressService.updateTaskProgress( roomDailyTaskProgressService.updateTaskProgress(
new RoomDailyTaskProgressUpdateCmd() new RoomDailyTaskProgressUpdateCmd()
.setUserId(param.getUserId()) .setUserId(param.getUserId())

View File

@ -48,6 +48,7 @@ import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent;
import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicMessage; import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicMessage;
import com.red.circle.other.infra.database.rds.entity.game.GameRoomPkIntegralRecord; import com.red.circle.other.infra.database.rds.entity.game.GameRoomPkIntegralRecord;
import com.red.circle.other.infra.database.rds.entity.game.GameRoomPkRecord; import com.red.circle.other.infra.database.rds.entity.game.GameRoomPkRecord;
import com.red.circle.other.infra.database.rds.entity.live.RoomMember;
import com.red.circle.other.infra.database.rds.entity.user.user.ConfessionChance; import com.red.circle.other.infra.database.rds.entity.user.user.ConfessionChance;
import com.red.circle.other.infra.database.rds.entity.user.user.CpBlessRecord; import com.red.circle.other.infra.database.rds.entity.user.user.CpBlessRecord;
import com.red.circle.other.infra.database.rds.entity.user.user.CpRelationship; import com.red.circle.other.infra.database.rds.entity.user.user.CpRelationship;
@ -206,26 +207,45 @@ public class GiftCountStrategy implements GiftStrategy {
// Spins 送礼物任务 // Spins 送礼物任务
handleSpinsGiftTask(runningWater); handleSpinsGiftTask(runningWater);
// roomDailyTask // 房间金币大放送
List<Long> acceptUserIds = runningWater.getAcceptUsers().stream().map(GiftAcceptUser::getAcceptUserId).toList(); handleRoomDailyTask(runningWater, roomProfile);
long actualAmount = runningWater.getGiftValue().getActualAmount().longValue();
// giftGiveRunningWaterService.addLog(runningWater.getId(), "结束:礼物统计相关");
}
private void handleRoomDailyTask(GiftGiveRunningWater runningWater, RoomProfile roomProfile) {
Long userId = runningWater.getUserId();
if (roomProfile == null) {
return;
}
RoomMember roomMember = roomMemberService.getRoomMember(roomProfile.getId(), userId);
if (Objects.isNull(roomMember)) {
return;
}
List<Long> acceptUserIds = runningWater.getAcceptUsers().stream()
.map(GiftAcceptUser::getAcceptUserId)
.filter(e -> !userId.equals(e))
.toList();
long actualAmount = getActualAmount(runningWater.getGiftValue(), runningWater.getGiftValue().getActualAmount());
// 给用户送礼 // 给用户送礼
handleSendGiftTask( runningWater.getUserId(), acceptUserIds, RoomDailyTaskCode.PERSONAL_SEND_GIFT); if (!roomMember.getUserId().equals(userId)) {
handleSendGiftTask(userId, acceptUserIds, RoomDailyTaskCode.PERSONAL_SEND_GIFT);
}
if (roomProfile != null) { if (roomProfile.getUserId().equals(userId)) {
if (roomProfile.getUserId().equals(runningWater.getUserId())) { // 房主给用户送礼物
// 房主给用户送礼物 handleSendGiftTask(userId, acceptUserIds, RoomDailyTaskCode.ROOM_OWNER_SEND_GIFT_USER);
handleSendGiftTask( runningWater.getUserId(), acceptUserIds, RoomDailyTaskCode.ROOM_OWNER_SEND_GIFT_USER);
// 房主累计送礼金币
handleOwnerGiftGoldTask(runningWater.getUserId(), actualAmount, RoomDailyTaskCode.ROOM_OWNER_SEND_GIFT_GOLD);
}
// 房主累计送礼金币
handleOwnerGiftGoldTask(userId, actualAmount, RoomDailyTaskCode.ROOM_OWNER_SEND_GIFT_GOLD);
} else {
// 房间用户累计送礼金币 // 房间用户累计送礼金币
handleOwnerGiftGoldTask(roomProfile.getUserId(), actualAmount, RoomDailyTaskCode.ROOM_USER_SEND_GIFT_GOLD); handleOwnerGiftGoldTask(roomProfile.getUserId(), actualAmount, RoomDailyTaskCode.ROOM_USER_SEND_GIFT_GOLD);
} }
// giftGiveRunningWaterService.addLog(runningWater.getId(), "结束:礼物统计相关");
} }
private void saveConfessionChance(GiftGiveRunningWater runningWater) { private void saveConfessionChance(GiftGiveRunningWater runningWater) {
@ -728,6 +748,10 @@ public class GiftCountStrategy implements GiftStrategy {
} }
private void handleSendGiftTask(Long userId, List<Long> acceptUserIds, RoomDailyTaskCode taskType) { private void handleSendGiftTask(Long userId, List<Long> acceptUserIds, RoomDailyTaskCode taskType) {
if (acceptUserIds.isEmpty()) {
return;
}
String redisKey = "room:daily:task:send_gift:" + taskType.name() + ":" + userId + ":" String redisKey = "room:daily:task:send_gift:" + taskType.name() + ":" + userId + ":"
+ ZonedDateTimeAsiaRiyadhUtils.now().toLocalDate(); + ZonedDateTimeAsiaRiyadhUtils.now().toLocalDate();