From 5124df543897494b00ae12baecdf712bdfbdb5de Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Fri, 28 Nov 2025 19:08:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=B8=E6=88=8F=E6=89=93=E6=A6=9C=E6=B4=BB?= =?UTF-8?q?=E5=8A=A8=E6=A0=B9=E6=8D=AE=E6=B4=BB=E5=8A=A8=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/service/game/GameBaishunServiceImpl.java | 12 ++++++++++-- .../mongo/service/sys/ActivityConfigService.java | 2 ++ .../sys/impl/ActivityConfigServiceImpl.java | 14 ++++++++++++++ .../other-start/src/test/java/SpringTest.java | 12 ++++++++++++ 4 files changed, 38 insertions(+), 2 deletions(-) diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/GameBaishunServiceImpl.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/GameBaishunServiceImpl.java index 95a44197..c1e585c2 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/GameBaishunServiceImpl.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/GameBaishunServiceImpl.java @@ -32,6 +32,8 @@ import com.red.circle.other.domain.ranking.RankingActivityType; import com.red.circle.other.domain.ranking.RankingCycleType; import com.red.circle.other.domain.ranking.RankingDimension; import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheService; +import com.red.circle.other.infra.database.mongo.entity.sys.ActivityConfig; +import com.red.circle.other.infra.database.mongo.service.sys.ActivityConfigService; 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.inner.enums.config.EnumConfigKey; @@ -75,8 +77,11 @@ public class GameBaishunServiceImpl implements GameBaishunService { private final GameListConfigService gameListConfigService; private final ImGroupClient imGroupClient; private final RankingActivityService rankingActivityService; + private final ActivityConfigService activityConfigService; @Value("${red-circle.game-rank.gameid}") private String gameId; + @Value("${red-circle.game-rank.templateId}") + private Long templateId; @Override public BaishunResponse getToken(BaishunTokenRequest request) { @@ -211,8 +216,11 @@ public class GameBaishunServiceImpl implements GameBaishunService { //游戏是否参与打榜活动 if (gameId != null && gameId.equals(request.getGameId()) && request.getCurrencyDiff() > 0) { - incGameRankingActivity(DataTypeUtils.toLong(request.getUserId()), 1, request.getCurrencyDiff(), - request.getGameRoundId()); + ActivityConfig config = activityConfigService.getOngoingActivityConf(templateId, RankingActivityType.GREEDY_GAME.name()); + if (config != null) { + incGameRankingActivity(DataTypeUtils.toLong(request.getUserId()), 1, request.getCurrencyDiff(), + request.getGameRoundId()); + } } diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/sys/ActivityConfigService.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/sys/ActivityConfigService.java index 71428932..965b6822 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/sys/ActivityConfigService.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/sys/ActivityConfigService.java @@ -71,6 +71,8 @@ public interface ActivityConfigService { ActivityConfig getShowcaseActivityConf(Long templateId, String activityType); + ActivityConfig getOngoingActivityConf(Long templateId, String activityType); + List listRecentlyEndedActivities(String sysOrigin, Integer limit); /** diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/sys/impl/ActivityConfigServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/sys/impl/ActivityConfigServiceImpl.java index c4e2e2c1..dccc2cf6 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/sys/impl/ActivityConfigServiceImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/sys/impl/ActivityConfigServiceImpl.java @@ -250,6 +250,20 @@ public class ActivityConfigServiceImpl implements ActivityConfigService { , ActivityConfig.class); } + public ActivityConfig getOngoingActivityConf(Long templateId, String activityType) { + Date now = TimestampUtils.now(); + Criteria criteria = Criteria.where("showcase").is(true); + criteria.and("templateId").is(templateId); + criteria.and("activityType").is(activityType); + criteria.and("startTime").lte(now); + criteria.and("endTime").gte(now); + + return mongoTemplate.findOne(Query.query(criteria) + .with(Sort.by(Sort.Order.desc("id"))) + .limit(1) + , ActivityConfig.class); + } + @Override public List listRecentlyEndedActivities(String sysOrigin, Integer limit) { Date now = TimestampUtils.now(); diff --git a/rc-service/rc-service-other/other-start/src/test/java/SpringTest.java b/rc-service/rc-service-other/other-start/src/test/java/SpringTest.java index 0ff82ce0..8a029ac9 100644 --- a/rc-service/rc-service-other/other-start/src/test/java/SpringTest.java +++ b/rc-service/rc-service-other/other-start/src/test/java/SpringTest.java @@ -21,6 +21,8 @@ import com.red.circle.other.domain.ranking.RankingActivityType; import com.red.circle.other.domain.ranking.RankingCycleType; import com.red.circle.other.domain.ranking.RankingDimension; import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheService; +import com.red.circle.other.infra.database.mongo.entity.sys.ActivityConfig; +import com.red.circle.other.infra.database.mongo.service.sys.ActivityConfigService; 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.inner.model.cmd.user.ApprovalAccountCmd; @@ -61,6 +63,16 @@ public class SpringTest { private AppUserDataViolationService userDataViolationService; @Autowired private RankingActivityService rankingActivityService; + @Autowired + private ActivityConfigService activityConfigService; + + @Test + public void testQuery() { + ActivityConfig ongoingActivityConf = activityConfigService.getOngoingActivityConf(1994334094730010626L, RankingActivityType.GREEDY_GAME.name()); + System.out.println(); + + + } @Test public void testGame() {