游戏热门排行榜处理-3 新增 latest

This commit is contained in:
tianfeng 2026-05-28 17:32:05 +08:00
parent e1e33f771f
commit ffbb9320dc
7 changed files with 39 additions and 0 deletions

View File

@ -30,6 +30,7 @@ public class GameRankingConvertor {
co.setSysOrigin(record.getSysOrigin());
co.setTotalPrizeAmount(record.getTotalPrizeAmount());
co.setPeriodType(record.getPeriodType());
co.setGameCreateTime(record.getGameCreateTime());
return co;
}
}

View File

@ -169,6 +169,7 @@ public class GameEventService {
.amount(gold)
.periodType(GameRankingPeriodType.WEEK.getCode())
.periodKey(ZonedDateTimeAsiaRiyadhUtils.nowWeekMondayToInt().toString())
.gameCreateTime(gameConfig.getCreateTime())
.build()
);
}

View File

@ -2,6 +2,10 @@ package com.red.circle.other.app.dto.clientobject.game;
import lombok.Data;
import java.sql.Timestamp;
import java.time.Duration;
import java.time.Instant;
/**
* 游戏排行榜返回对象.
*
@ -51,4 +55,16 @@ public class GameRankingCO {
* 周期类型
*/
private String periodType;
/**
* 游戏创建时间
*/
private Timestamp gameCreateTime;
public boolean isLatest() {
if (gameCreateTime == null) {
return false;
}
return Duration.between(gameCreateTime.toInstant(), Instant.now()).toDays() < 7;
}
}

View File

@ -57,6 +57,11 @@ public class GameRankingIncrementCmd {
*/
private String periodKey;
/**
* 游戏创建时间
*/
private java.sql.Timestamp gameCreateTime;
/**
* 中奖金额单位
*/

View File

@ -2,6 +2,9 @@ package com.red.circle.other.domain.game;
import lombok.Data;
import java.sql.Timestamp;
import java.time.LocalDateTime;
/**
* 游戏排行榜领域对象.
*
@ -56,4 +59,9 @@ public class GameRankingRecord {
* 总中奖金额单位
*/
private Long totalPrizeAmount;
/**
* 游戏创建时间
*/
private Timestamp gameCreateTime;
}

View File

@ -6,6 +6,7 @@ import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.CompoundIndexes;
import org.springframework.data.mongodb.core.mapping.Document;
import java.sql.Timestamp;
import java.time.LocalDateTime;
/**
@ -76,6 +77,11 @@ public class GameRanking {
*/
private Long totalPrizeAmount;
/**
* 游戏创建时间
*/
private Timestamp gameCreateTime;
/**
* 创建时间
*/

View File

@ -86,6 +86,7 @@ public class GameRankingGatewayImpl implements GameRankingGateway {
update.setOnInsert("gameId", cmd.getGameId());
update.setOnInsert("periodType", cmd.getPeriodType());
update.setOnInsert("periodKey", cmd.getPeriodKey());
update.setOnInsert("gameCreateTime", cmd.getGameCreateTime());
update.setOnInsert("gameCover", cmd.getGameCover());
update.setOnInsert("gameUrl", cmd.getGameUrl());
update.setOnInsert("gameName", cmd.getGameName());
@ -107,6 +108,7 @@ public class GameRankingGatewayImpl implements GameRankingGateway {
record.setPeriodType(entity.getPeriodType());
record.setPeriodKey(entity.getPeriodKey());
record.setTotalPrizeAmount(entity.getTotalPrizeAmount());
record.setGameCreateTime(entity.getGameCreateTime());
return record;
}
}