房间金币大放送-每日任务麦位统计更改
This commit is contained in:
parent
bbfec84001
commit
4046be18ed
@ -29,6 +29,7 @@ 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.game.GameActivityService;
|
||||
import com.red.circle.other.app.service.task.RoomDailyTaskProgressService;
|
||||
import com.red.circle.other.app.util.DateTimeAsiaRiyadhUtils;
|
||||
import com.red.circle.other.app.util.OfficialNoticeUtils;
|
||||
import com.red.circle.other.domain.game.GameRankingIncrementCmd;
|
||||
import com.red.circle.other.domain.gateway.game.GameRankingGateway;
|
||||
@ -51,6 +52,7 @@ import com.red.circle.tool.crypto.SecurityUtils;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@ -193,13 +195,7 @@ public class GameHkysRestController {
|
||||
activityRechargeTicketService.accumulatedRechargeAndAddTicket(userId, Math.abs(cmd.getCoin()), MonthlyRechargeType.UNDEFINED);
|
||||
} else {
|
||||
|
||||
RoomDailyTaskCode taskType = RoomDailyTaskCode.PERSONAL_GAME_CONSUME;
|
||||
roomDailyTaskProgressService.updateTaskProgress(
|
||||
new RoomDailyTaskProgressUpdateCmd()
|
||||
.setUserId(userId)
|
||||
.setTaskCode(taskType.name())
|
||||
.setProgressValue(param.getCoin().intValue())
|
||||
);
|
||||
updateRoomDailyTask(cmd.getCoin(), userId);
|
||||
}
|
||||
|
||||
|
||||
@ -208,7 +204,20 @@ public class GameHkysRestController {
|
||||
.setData(jsonObject);
|
||||
}
|
||||
|
||||
private void incGameRankingRecord(GameLxwlUpdateBalanceCmd request, GameListConfig gameListConfig) {
|
||||
private void updateRoomDailyTask(Long coins, Long userId) {
|
||||
RoomDailyTaskCode taskType = RoomDailyTaskCode.PERSONAL_GAME_CONSUME;
|
||||
String redisKey = "room:daily:task:progress:" + taskType.name() + ":" + userId + ":" + ZonedDateTimeAsiaRiyadhUtils.now().toLocalDate();
|
||||
Long total = redisService.increment(redisKey, Math.abs(coins.intValue()));
|
||||
redisService.expire(redisKey, DateTimeAsiaRiyadhUtils.getSecondsUntilMidnight(), TimeUnit.SECONDS);
|
||||
roomDailyTaskProgressService.updateTaskProgress(
|
||||
new RoomDailyTaskProgressUpdateCmd()
|
||||
.setUserId(userId)
|
||||
.setTaskCode(taskType.name())
|
||||
.setProgressValue(total.intValue())
|
||||
);
|
||||
}
|
||||
|
||||
private void incGameRankingRecord(GameLxwlUpdateBalanceCmd request, GameListConfig gameListConfig) {
|
||||
if (request.getType() != 2 || gameListConfig == null || request.getCoin() <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -11,7 +11,9 @@ import com.red.circle.other.app.convertor.RoomRedPacketAppConvertor;
|
||||
import com.red.circle.other.app.convertor.user.UserProfileAppConvertor;
|
||||
import com.red.circle.other.app.dto.clientobject.RoomRedPacketCO;
|
||||
import com.red.circle.other.app.dto.cmd.SendRoomRedPacketCmd;
|
||||
import com.red.circle.other.app.dto.cmd.task.RoomDailyTaskProgressUpdateCmd;
|
||||
import com.red.circle.other.app.enums.RoomRewardLevelEnum;
|
||||
import com.red.circle.other.app.service.task.RoomDailyTaskProgressService;
|
||||
import com.red.circle.other.app.util.OfficialNoticeUtils;
|
||||
import com.red.circle.other.domain.gateway.RoomRedPacketGateway;
|
||||
import com.red.circle.other.domain.gateway.user.UserProfileGateway;
|
||||
@ -22,10 +24,12 @@ import com.red.circle.other.domain.redpacket.RoomRedPacketStatus;
|
||||
import com.red.circle.other.domain.redpacket.RoomRedPacketType;
|
||||
import com.red.circle.other.infra.database.cache.service.other.RoomRedPacketCacheService;
|
||||
import com.red.circle.other.infra.database.mongo.entity.activity.RoomContributionActivityCount;
|
||||
import com.red.circle.other.infra.database.mongo.entity.live.RoomProfileManager;
|
||||
import com.red.circle.other.infra.database.mongo.service.activity.RoomContributionActivityCountService;
|
||||
import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService;
|
||||
import com.red.circle.other.inner.asserts.OtherErrorCode;
|
||||
import com.red.circle.other.inner.asserts.RoomErrorCode;
|
||||
import com.red.circle.other.inner.enums.task.RoomDailyTaskCode;
|
||||
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
|
||||
import com.red.circle.tool.core.date.ZonedDateTimeAsiaRiyadhUtils;
|
||||
import com.red.circle.tool.core.sequence.IdWorkerUtils;
|
||||
@ -33,7 +37,6 @@ import com.red.circle.tool.core.tuple.PennyAmount;
|
||||
import com.red.circle.wallet.inner.endpoint.wallet.WalletGoldClient;
|
||||
import com.red.circle.wallet.inner.error.WalletErrorCode;
|
||||
import com.red.circle.wallet.inner.model.cmd.GoldReceiptCmd;
|
||||
import com.red.circle.wallet.inner.model.cmd.WalletReceiptCmd;
|
||||
import com.red.circle.wallet.inner.model.enums.GoldOrigin;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -62,6 +65,7 @@ public class SendRoomRedPacketCmdExe {
|
||||
private final UserProfileAppConvertor userProfileAppConvertor;
|
||||
private final RoomProfileManagerService roomProfileManagerService;
|
||||
private final RoomContributionActivityCountService roomContributionActivityCountService;
|
||||
private final RoomDailyTaskProgressService roomDailyTaskProgressService;
|
||||
|
||||
/**
|
||||
* 执行发红包(用户红包)
|
||||
@ -106,6 +110,8 @@ public class SendRoomRedPacketCmdExe {
|
||||
// 发送飘窗通知
|
||||
sendMessage(cmd, packetId);
|
||||
|
||||
updateRoomDailyTask(cmd.getRoomId(), userId);
|
||||
|
||||
log.info("发红包成功 userId={} packetId={} roomId={} type={} amount={} count={}",
|
||||
userId, packetId, cmd.getRoomId(), cmd.getPacketType(),
|
||||
cmd.getTotalAmount(), cmd.getTotalCount());
|
||||
@ -113,6 +119,25 @@ public class SendRoomRedPacketCmdExe {
|
||||
return RoomRedPacketAppConvertor.toCO(redPacket);
|
||||
}
|
||||
|
||||
private void updateRoomDailyTask(Long roomId, Long userId) {
|
||||
RoomProfileManager roomProfileManager = roomProfileManagerService.getById(roomId);
|
||||
if (roomProfileManager == null || !Objects.equals(roomProfileManager.getUserId(), userId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
roomDailyTaskProgressService.updateTaskProgress(
|
||||
new RoomDailyTaskProgressUpdateCmd()
|
||||
.setUserId(userId)
|
||||
.setTaskCode(RoomDailyTaskCode.ROOM_OWNER_SEND_RED_PACKET.name())
|
||||
.setProgressValue(1)
|
||||
);
|
||||
} catch (Exception e) {
|
||||
log.error(e .getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 执行发平台红包
|
||||
*/
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package com.red.circle.other.app.command.room;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.red.circle.common.business.core.enums.SysOriginPlatformEnum;
|
||||
import com.red.circle.external.inner.endpoint.message.TrtcClient;
|
||||
import com.red.circle.framework.core.asserts.ResponseAssert;
|
||||
@ -18,10 +17,12 @@ import com.red.circle.other.app.dto.clientobject.room.EntryRoomResponseCO;
|
||||
import com.red.circle.other.app.dto.clientobject.room.RoomThemeCO;
|
||||
import com.red.circle.other.app.dto.cmd.room.RoomEntryCmd;
|
||||
import com.red.circle.other.app.dto.cmd.room.UpdateRoomSettingCmd;
|
||||
import com.red.circle.other.app.dto.cmd.task.RoomDailyTaskProgressUpdateCmd;
|
||||
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.gateway.user.ability.UserRegionGateway;
|
||||
import com.red.circle.other.domain.model.user.NobleAbilityCO;
|
||||
import com.red.circle.other.domain.model.user.UserProfile;
|
||||
import com.red.circle.other.infra.database.cache.service.other.RoomManagerCacheService;
|
||||
import com.red.circle.other.infra.database.cache.service.user.UserAgoraTokenCacheService;
|
||||
import com.red.circle.other.infra.database.mongo.entity.live.RoomProfile;
|
||||
@ -39,14 +40,16 @@ import com.red.circle.other.inner.enums.material.PropsCommodityType;
|
||||
import com.red.circle.other.inner.enums.material.PropsVipActualEquityEnum;
|
||||
import com.red.circle.other.inner.enums.room.RoomEventEnum;
|
||||
import com.red.circle.other.inner.enums.room.RoomTakeMicRoleEnum;
|
||||
import com.red.circle.other.inner.enums.task.RoomDailyTaskCode;
|
||||
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.WealthAndCharmLevelDTO;
|
||||
import com.red.circle.other.inner.model.dto.user.props.UserPropsResourcesDTO;
|
||||
import com.red.circle.other.inner.model.dto.user.props.UserUsePropsDTO;
|
||||
import com.red.circle.component.redis.service.RedisService;
|
||||
import com.red.circle.tool.core.collection.CollectionUtils;
|
||||
import com.red.circle.tool.core.date.LocalDateTimeUtils;
|
||||
import com.red.circle.tool.core.date.TimestampUtils;
|
||||
import com.red.circle.tool.core.date.ZonedDateTimeAsiaRiyadhUtils;
|
||||
import com.red.circle.tool.core.json.JacksonUtils;
|
||||
import com.red.circle.tool.core.sequence.IdWorkerUtils;
|
||||
import com.red.circle.tool.core.text.StringUtils;
|
||||
@ -58,6 +61,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
@ -85,6 +89,9 @@ public class RoomEnterCmdExe {
|
||||
private final TaskMqMessage taskMqMessage;
|
||||
private final AdministratorAuthService administratorAuthService;
|
||||
private final RocketRewardClaimCmdExe rocketRewardClaimCmdExe;
|
||||
private final RoomDailyTaskProgressService roomDailyTaskProgressService;
|
||||
private final RedisService redisService;
|
||||
private final RedisTemplate redisTemplate;
|
||||
|
||||
public EntryRoomResponseCO execute(RoomEntryCmd cmd) {
|
||||
//checkEntryUserId(cmd);
|
||||
@ -127,6 +134,9 @@ public class RoomEnterCmdExe {
|
||||
log.error("进房间添加足迹异常:{}", e.getMessage());
|
||||
}
|
||||
|
||||
// 房间每日任务
|
||||
updateRoomDailyTask(cmd.getReqUserId(), manager.getUserId());
|
||||
|
||||
return new EntryRoomResponseCO()
|
||||
.setRoomProfile(
|
||||
new EntryRoomProfileCO()
|
||||
@ -151,6 +161,29 @@ public class RoomEnterCmdExe {
|
||||
);
|
||||
}
|
||||
|
||||
private void updateRoomDailyTask(Long enterUserId, Long roomOwnerId) {
|
||||
// 只处理用户进入非自己房间的情况
|
||||
if (Objects.equals(enterUserId, roomOwnerId)) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
// Redis 去重:同一用户当天进入同一房间只计一次
|
||||
String redisKey = "room:daily:task:new_member:" + roomOwnerId + ":" + ZonedDateTimeAsiaRiyadhUtils.now().toLocalDate();
|
||||
redisTemplate.opsForSet().add(redisKey, enterUserId);
|
||||
redisService.expire(redisKey, DateTimeAsiaRiyadhUtils.getSecondsUntilMidnight(), TimeUnit.SECONDS);
|
||||
|
||||
long uniqueCount = redisService.setSize(redisKey);
|
||||
roomDailyTaskProgressService.updateTaskProgress(
|
||||
new RoomDailyTaskProgressUpdateCmd()
|
||||
.setUserId(roomOwnerId)
|
||||
.setTaskCode(RoomDailyTaskCode.ROOM_NEW_MEMBER.name())
|
||||
.setProgressValue((int) uniqueCount)
|
||||
);
|
||||
} catch (Exception e) {
|
||||
log.error("更新房间每日任务失败, roomOwnerId={}, enterUserId={}", roomOwnerId, enterUserId, e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 异步拿声网观众token,5分钟拿不到就返回默认一串字符串
|
||||
* @param cmd
|
||||
|
||||
@ -8,6 +8,7 @@ import com.red.circle.mq.rocket.business.producer.TaskMqMessage;
|
||||
import com.red.circle.other.app.dto.cmd.task.RoomDailyTaskProgressUpdateCmd;
|
||||
import com.red.circle.other.app.service.task.RoomDailyTaskProgressService;
|
||||
import com.red.circle.other.app.service.task.TaskService;
|
||||
import com.red.circle.other.app.util.DateTimeAsiaRiyadhUtils;
|
||||
import com.red.circle.other.infra.common.team.TeamTargetCommon;
|
||||
import com.red.circle.other.infra.database.mongo.entity.live.RoomProfile;
|
||||
import com.red.circle.other.infra.database.mongo.entity.team.team.TeamMemberTarget;
|
||||
@ -99,11 +100,15 @@ public class TeamMemberHeartbeatCmdExe {
|
||||
}
|
||||
|
||||
private void updateDailyTask(AppRoomIdCmd cmd, RoomDailyTaskCode taskType) {
|
||||
Long userId = cmd.requiredReqUserId();
|
||||
String redisKey = "room:daily:task:progress:" + taskType.name() + ":" + userId + ":" + ZonedDateTimeAsiaRiyadhUtils.now().toLocalDate();
|
||||
Long total = redisService.increment(redisKey, 1);
|
||||
redisService.expire(redisKey, DateTimeAsiaRiyadhUtils.getSecondsUntilMidnight(), TimeUnit.SECONDS);
|
||||
roomDailyTaskProgressService.updateTaskProgress(
|
||||
new RoomDailyTaskProgressUpdateCmd()
|
||||
.setUserId(cmd.requiredReqUserId())
|
||||
.setUserId(userId)
|
||||
.setTaskCode(taskType.name())
|
||||
.setProgressValue(1)
|
||||
.setProgressValue(total.intValue())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -32,6 +32,7 @@ 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.service.task.TaskService;
|
||||
import com.red.circle.other.app.util.DateTimeAsiaRiyadhUtils;
|
||||
import com.red.circle.other.app.util.OfficialNoticeUtils;
|
||||
import com.red.circle.other.domain.game.GameRankingIncrementCmd;
|
||||
import com.red.circle.other.domain.gateway.game.GameRankingGateway;
|
||||
@ -228,13 +229,7 @@ public class GameBaishunServiceImpl implements GameBaishunService {
|
||||
// 累加用户获得的金币并发送抽奖券
|
||||
activityRechargeTicketService.accumulatedRechargeAndAddTicket(userId, request.getCurrencyDiff(), MonthlyRechargeType.UNDEFINED);
|
||||
} else {
|
||||
RoomDailyTaskCode taskType = RoomDailyTaskCode.PERSONAL_GAME_CONSUME;
|
||||
roomDailyTaskProgressService.updateTaskProgress(
|
||||
new RoomDailyTaskProgressUpdateCmd()
|
||||
.setUserId(userId)
|
||||
.setTaskCode(taskType.name())
|
||||
.setProgressValue(Math.abs(request.getCurrencyDiff().intValue()))
|
||||
);
|
||||
updateRoomDailyTask(request.getCurrencyDiff(), userId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -256,6 +251,19 @@ public class GameBaishunServiceImpl implements GameBaishunService {
|
||||
return BaishunResponse.fail(BaishunErrorCode.SERVER_ERROR);
|
||||
}
|
||||
|
||||
private void updateRoomDailyTask(Long coins, Long userId) {
|
||||
RoomDailyTaskCode taskType = RoomDailyTaskCode.PERSONAL_GAME_CONSUME;
|
||||
String redisKey = "room:daily:task:progress:" + taskType.name() + ":" + userId + ":" + ZonedDateTimeAsiaRiyadhUtils.now().toLocalDate();
|
||||
Long total = redisService.increment(redisKey, Math.abs(coins.intValue()));
|
||||
redisService.expire(redisKey, DateTimeAsiaRiyadhUtils.getSecondsUntilMidnight(), TimeUnit.SECONDS);
|
||||
roomDailyTaskProgressService.updateTaskProgress(
|
||||
new RoomDailyTaskProgressUpdateCmd()
|
||||
.setUserId(userId)
|
||||
.setTaskCode(taskType.name())
|
||||
.setProgressValue(total.intValue())
|
||||
);
|
||||
}
|
||||
|
||||
private void sendBroadcast(BaishunChangeCurrencyRequest request, GameListConfig gameListConfig) {
|
||||
if (gameListConfig == null) {
|
||||
return;
|
||||
|
||||
@ -26,6 +26,7 @@ import com.red.circle.other.app.service.activity.RankingActivityService;
|
||||
import com.red.circle.other.app.service.game.override.domain.HotGameUserProfile;
|
||||
import com.red.circle.other.app.service.game.override.service.HotGameService;
|
||||
import com.red.circle.other.app.service.task.RoomDailyTaskProgressService;
|
||||
import com.red.circle.other.app.util.DateTimeAsiaRiyadhUtils;
|
||||
import com.red.circle.other.app.util.OfficialNoticeUtils;
|
||||
import com.red.circle.other.domain.game.GameRankingIncrementCmd;
|
||||
import com.red.circle.other.domain.gateway.game.GameRankingGateway;
|
||||
@ -333,13 +334,7 @@ public class HotGameServiceImpl implements HotGameService {
|
||||
|
||||
// 处理游戏消费人任务
|
||||
else {
|
||||
RoomDailyTaskCode taskType = RoomDailyTaskCode.PERSONAL_GAME_CONSUME;
|
||||
roomDailyTaskProgressService.updateTaskProgress(
|
||||
new RoomDailyTaskProgressUpdateCmd()
|
||||
.setUserId(userId)
|
||||
.setTaskCode(taskType.name())
|
||||
.setProgressValue(param.getCoin().intValue())
|
||||
);
|
||||
updateRoomDailyTask(param.getCoin(), userId);
|
||||
}
|
||||
|
||||
return new HotGameResponse<HotGameCoin>()
|
||||
@ -362,6 +357,19 @@ public class HotGameServiceImpl implements HotGameService {
|
||||
.setErrorCode(HotGameErrorEnum.SERVER_ERROR.getErrorCode());
|
||||
}
|
||||
|
||||
private void updateRoomDailyTask(Long coins, Long userId) {
|
||||
RoomDailyTaskCode taskType = RoomDailyTaskCode.PERSONAL_GAME_CONSUME;
|
||||
String redisKey = "room:daily:task:progress:" + taskType.name() + ":" + userId + ":" + ZonedDateTimeAsiaRiyadhUtils.now().toLocalDate();
|
||||
Long total = redisService.increment(redisKey, Math.abs(coins.intValue()));
|
||||
redisService.expire(redisKey, DateTimeAsiaRiyadhUtils.getSecondsUntilMidnight(), TimeUnit.SECONDS);
|
||||
roomDailyTaskProgressService.updateTaskProgress(
|
||||
new RoomDailyTaskProgressUpdateCmd()
|
||||
.setUserId(userId)
|
||||
.setTaskCode(taskType.name())
|
||||
.setProgressValue(total.intValue())
|
||||
);
|
||||
}
|
||||
|
||||
private void incGameRankingTmpActivity(HotGameUserCoinUpdate request) {
|
||||
if (ZonedDateTimeAsiaRiyadhUtils.now().isAfter(getFinishTime())) {
|
||||
return;
|
||||
|
||||
@ -2,6 +2,7 @@ package com.red.circle.other.app.service.game;
|
||||
|
||||
import com.red.circle.auth.inner.endpoint.AuthClient;
|
||||
import com.red.circle.common.business.core.enums.SysOriginPlatformEnum;
|
||||
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.enums.message.GroupMessageTypeEnum;
|
||||
@ -18,6 +19,7 @@ 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.game.override.service.YomiGameService;
|
||||
import com.red.circle.other.app.service.task.RoomDailyTaskProgressService;
|
||||
import com.red.circle.other.app.util.DateTimeAsiaRiyadhUtils;
|
||||
import com.red.circle.other.app.util.OfficialNoticeUtils;
|
||||
import com.red.circle.other.domain.game.GameRankingIncrementCmd;
|
||||
import com.red.circle.other.domain.gateway.game.GameRankingGateway;
|
||||
@ -73,6 +75,7 @@ public class YomiGameServiceImpl implements YomiGameService {
|
||||
private final GameRankingGateway gameRankingGateway;
|
||||
private final ActivityRechargeTicketService activityRechargeTicketService;
|
||||
private final RoomDailyTaskProgressService roomDailyTaskProgressService;
|
||||
private final RedisService redisService;
|
||||
|
||||
@Override
|
||||
public YomiTokenCO getToken(YomiGetTokenCmd cmd) {
|
||||
@ -184,13 +187,7 @@ public class YomiGameServiceImpl implements YomiGameService {
|
||||
// 累加用户获得的金币并发送抽奖券
|
||||
activityRechargeTicketService.accumulatedRechargeAndAddTicket(userId, Math.abs(changeValue.longValue()), MonthlyRechargeType.UNDEFINED);
|
||||
} else {
|
||||
RoomDailyTaskCode taskType = RoomDailyTaskCode.PERSONAL_GAME_CONSUME;
|
||||
roomDailyTaskProgressService.updateTaskProgress(
|
||||
new RoomDailyTaskProgressUpdateCmd()
|
||||
.setUserId(userId)
|
||||
.setTaskCode(taskType.name())
|
||||
.setProgressValue(cmd.getChangeValue())
|
||||
);
|
||||
updateRoomDailyTask(changeValue.longValue(), userId);
|
||||
}
|
||||
|
||||
return new YomiBalanceCO(currentBalance);
|
||||
@ -202,6 +199,19 @@ public class YomiGameServiceImpl implements YomiGameService {
|
||||
}
|
||||
}
|
||||
|
||||
private void updateRoomDailyTask(Long coins, Long userId) {
|
||||
RoomDailyTaskCode taskType = RoomDailyTaskCode.PERSONAL_GAME_CONSUME;
|
||||
String redisKey = "room:daily:task:progress:" + taskType.name() + ":" + userId + ":" + ZonedDateTimeAsiaRiyadhUtils.now().toLocalDate();
|
||||
Long total = redisService.increment(redisKey, Math.abs(coins.intValue()));
|
||||
redisService.expire(redisKey, DateTimeAsiaRiyadhUtils.getSecondsUntilMidnight(), TimeUnit.SECONDS);
|
||||
roomDailyTaskProgressService.updateTaskProgress(
|
||||
new RoomDailyTaskProgressUpdateCmd()
|
||||
.setUserId(userId)
|
||||
.setTaskCode(taskType.name())
|
||||
.setProgressValue(total.intValue())
|
||||
);
|
||||
}
|
||||
|
||||
private static boolean isConsume(YomiChangeBalanceCmd cmd) {
|
||||
return "bet".equals(cmd.getChangeCause());
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user