游戏增加endTime 结束时间配置
This commit is contained in:
parent
47dcfe6d31
commit
67a9010adf
@ -38,6 +38,7 @@ import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheSe
|
|||||||
import com.red.circle.other.infra.database.cache.service.other.GameListCacheService;
|
import com.red.circle.other.infra.database.cache.service.other.GameListCacheService;
|
||||||
import com.red.circle.other.infra.database.rds.entity.sys.GameListConfig;
|
import com.red.circle.other.infra.database.rds.entity.sys.GameListConfig;
|
||||||
import com.red.circle.other.infra.database.rds.service.sys.GameListConfigService;
|
import com.red.circle.other.infra.database.rds.service.sys.GameListConfigService;
|
||||||
|
import com.red.circle.other.infra.utils.ZonedDateTimeUtils;
|
||||||
import com.red.circle.other.inner.enums.config.EnumConfigKey;
|
import com.red.circle.other.inner.enums.config.EnumConfigKey;
|
||||||
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.date.LocalDateTimeUtils;
|
import com.red.circle.tool.core.date.LocalDateTimeUtils;
|
||||||
@ -55,6 +56,11 @@ import com.red.circle.wallet.inner.model.dto.WalletReceiptResDTO;
|
|||||||
import com.red.circle.wallet.inner.model.enums.GoldOrigin;
|
import com.red.circle.wallet.inner.model.enums.GoldOrigin;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.time.chrono.ChronoZonedDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@ -89,6 +95,8 @@ public class HotGameServiceImpl implements HotGameService {
|
|||||||
private final RankingActivityService rankingActivityService;
|
private final RankingActivityService rankingActivityService;
|
||||||
@Value("${red-circle.game-rank.gameid}")
|
@Value("${red-circle.game-rank.gameid}")
|
||||||
private String gameId;
|
private String gameId;
|
||||||
|
@Value("${red-circle.game-rank.endTime}")
|
||||||
|
private String endTime;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HotGameResponse<HotGameUserProfile> getUserProfile(HotGameUserProfileQuery query) {
|
public HotGameResponse<HotGameUserProfile> getUserProfile(HotGameUserProfileQuery query) {
|
||||||
@ -249,12 +257,16 @@ public class HotGameServiceImpl implements HotGameService {
|
|||||||
|
|
||||||
private void incGameRankingTmpActivity(HotGameUserCoinUpdate request) {
|
private void incGameRankingTmpActivity(HotGameUserCoinUpdate request) {
|
||||||
if (gameId != null && gameId.equals(request.getGameId()) && request.getType() == 2 && request.getCoin() > 0) {
|
if (gameId != null && gameId.equals(request.getGameId()) && request.getType() == 2 && request.getCoin() > 0) {
|
||||||
|
ZonedDateTime gameEndTime = getGameEndTime(endTime);
|
||||||
|
if (gameEndTime == null || ZonedDateTimeAsiaRiyadhUtils.now().isAfter(gameEndTime)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
RankingDataUpdateCmd receiverCmd = new RankingDataUpdateCmd();
|
RankingDataUpdateCmd receiverCmd = new RankingDataUpdateCmd();
|
||||||
receiverCmd.setUserId(DataTypeUtils.toLong(request.getUid()));
|
receiverCmd.setUserId(DataTypeUtils.toLong(request.getUid()));
|
||||||
receiverCmd.setUserSex(1);
|
receiverCmd.setUserSex(1);
|
||||||
receiverCmd.setActivityType(RankingActivityType.FRUIT_PARTY.getCode());
|
receiverCmd.setActivityType(RankingActivityType.FRUIT_PARTY.getCode());
|
||||||
receiverCmd.setCycleType(RankingCycleType.WEEKLY.getCode());
|
receiverCmd.setCycleType(RankingCycleType.MONTHLY.getCode());
|
||||||
receiverCmd.setCycleKey(ZonedDateTimeAsiaRiyadhUtils.nowWeekMondayToInt().toString());
|
receiverCmd.setCycleKey("202512");
|
||||||
receiverCmd.setDimension(RankingDimension.GAME_WIN.getCode());
|
receiverCmd.setDimension(RankingDimension.GAME_WIN.getCode());
|
||||||
receiverCmd.setIncrementQuantity(request.getCoin());
|
receiverCmd.setIncrementQuantity(request.getCoin());
|
||||||
receiverCmd.setBizNo(request.getGameId());
|
receiverCmd.setBizNo(request.getGameId());
|
||||||
@ -263,6 +275,18 @@ public class HotGameServiceImpl implements HotGameService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ZonedDateTime getGameEndTime(String endTime) {
|
||||||
|
if (StringUtils.isBlank(endTime)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
LocalDateTime localDateTime = LocalDateTime.parse(endTime,DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||||
|
return localDateTime.atZone(ZoneId.of("Asia/Riyadh"));
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private void incGameRankingRecord(HotGameUserCoinUpdate request, GameListConfig gameListConfig) {
|
private void incGameRankingRecord(HotGameUserCoinUpdate request, GameListConfig gameListConfig) {
|
||||||
if (request.getType() != 2 || gameListConfig == null || request.getCoin() <= 0) {
|
if (request.getType() != 2 || gameListConfig == null || request.getCoin() <= 0) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user