From 2891b2d16fea067ec4cf93d3ceb7487c33182764 Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Thu, 18 Dec 2025 17:47:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=B8=E6=88=8F=E8=8E=B7=E8=83=9C=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=89=93=E6=A6=9C=E6=B4=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../game/party3rd/GameHkysRestController.java | 36 ++++++++++++++----- .../service/game/GameBaishunServiceImpl.java | 11 +++--- .../app/service/game/HotGameServiceImpl.java | 26 ++++++++++++++ 3 files changed, 59 insertions(+), 14 deletions(-) diff --git a/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/game/party3rd/GameHkysRestController.java b/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/game/party3rd/GameHkysRestController.java index ca966086..5ca2ff7b 100644 --- a/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/game/party3rd/GameHkysRestController.java +++ b/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/game/party3rd/GameHkysRestController.java @@ -17,19 +17,25 @@ import com.red.circle.component.game.hotgame.response.HotGameResponse; 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; +import com.red.circle.framework.core.dto.ReqSysOrigin; import com.red.circle.framework.core.security.UserCredential; import com.red.circle.framework.web.annotation.IgnoreResultResponse; import com.red.circle.mq.business.model.event.task.TaskApprovalEvent; import com.red.circle.mq.rocket.business.producer.TaskMqMessage; import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; +import com.red.circle.other.app.dto.cmd.activity.RankingDataUpdateCmd; import com.red.circle.other.app.dto.cmd.game.GameLxwlUpdateBalanceCmd; import com.red.circle.other.app.dto.cmd.game.GameLxwlUserInfoCmd; import com.red.circle.other.app.enums.violation.GameOriginEnum; import com.red.circle.other.app.enums.violation.ViolationTypeEnum; +import com.red.circle.other.app.service.activity.RankingActivityService; 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; import com.red.circle.other.domain.gateway.user.UserProfileGateway; +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.cache.service.other.GameListCacheService; import com.red.circle.other.infra.database.rds.entity.sys.GameListConfig; @@ -38,6 +44,7 @@ import com.red.circle.other.inner.enums.config.EnumConfigKey; import com.red.circle.other.inner.enums.team.TeamPolicyTypeEnum; 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.ZonedDateTimeAsiaRiyadhUtils; import com.red.circle.tool.core.parse.DataTypeUtils; import com.red.circle.tool.core.text.StringUtils; import com.red.circle.tool.crypto.SecurityUtils; @@ -77,6 +84,7 @@ public class GameHkysRestController { private final ImGroupClient imGroupClient; private final GameRankingGateway gameRankingGateway; private final GameListCacheService gameListCacheService; + private final RankingActivityService rankingActivityService; @IgnoreResultResponse @PostMapping("/getUserInfo") @@ -167,18 +175,12 @@ public class GameHkysRestController { } } + //游戏参与打榜活动 + incGameRankingActivity(cmd); + //累计游戏排行榜 incGameRankingRecord(cmd, gameListConfig); - /*taskMqMessage.sendTask(TaskApprovalEvent.builder() - .taskId(4) - .userId(userId) - .day(LocalDateTimeUtils.nowFormat("yyyy-MM-dd")) - .currencyDiff(cmd.getCoin()) - .sysOrigin(UserCredential.parseToken(cmd.getToken()).getSysOrigin()) - .gameName(GoldOrigin.HKYS_GAME.name()) - .gameId(Long.parseLong(cmd.getGameId())) - .build());*/ return new HkysResponse() .setErrorCode(HyksErrorEnum.SUCCESS.getErrorCode()) .setData(jsonObject); @@ -202,6 +204,22 @@ public class GameHkysRestController { gameRankingGateway.incrementPrizeAmount(build); } + private void incGameRankingActivity(GameLxwlUpdateBalanceCmd request) { + if (request.getCoin() > 0) { + RankingDataUpdateCmd receiverCmd = new RankingDataUpdateCmd(); + receiverCmd.setUserId(DataTypeUtils.toLong(request.getUid())); + receiverCmd.setUserSex(1); + receiverCmd.setActivityType(RankingActivityType.KING_GAMES.getCode()); + receiverCmd.setCycleType(RankingCycleType.WEEKLY.getCode()); + receiverCmd.setCycleKey(ZonedDateTimeAsiaRiyadhUtils.nowWeekMondayToInt().toString()); + receiverCmd.setDimension(RankingDimension.GAME_WIN.getCode()); + receiverCmd.setIncrementQuantity(request.getCoin()); + receiverCmd.setBizNo(request.getGameId()); + receiverCmd.setReqSysOrigin(ReqSysOrigin.of("LIKEI")); + rankingActivityService.accumulateRankingData(receiverCmd); + } + } + @IgnoreResultResponse @PostMapping("/orderCompensation") public HkysResponse orderCompensation(@RequestBody JSONObject object) { 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 461e875c..7eee4fa0 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 @@ -43,6 +43,7 @@ import com.red.circle.other.inner.enums.config.EnumConfigKey; import com.red.circle.other.inner.model.dto.user.UserProfileDTO; import com.red.circle.tool.core.date.DateUtils; import com.red.circle.tool.core.date.LocalDateTimeUtils; +import com.red.circle.tool.core.date.ZonedDateTimeAsiaRiyadhUtils; import com.red.circle.tool.core.json.JacksonUtils; import com.red.circle.tool.core.parse.DataTypeUtils; import com.red.circle.wallet.inner.endpoint.wallet.WalletGoldClient; @@ -204,7 +205,7 @@ public class GameBaishunServiceImpl implements GameBaishunService { if (Objects.nonNull(gameListConfig)) { sendBroadcast(request, gameListConfig); - //游戏是否参与打榜活动 + //游戏参与打榜活动 incGameRankingActivity(request); //累计游戏排行榜 @@ -277,13 +278,13 @@ public class GameBaishunServiceImpl implements GameBaishunService { } private void incGameRankingActivity(BaishunChangeCurrencyRequest request) { - if (gameId != null && gameId.equals(request.getGameId()) && request.getCurrencyDiff() > 0) { + if (request.getCurrencyDiff() > 0) { RankingDataUpdateCmd receiverCmd = new RankingDataUpdateCmd(); receiverCmd.setUserId(DataTypeUtils.toLong(request.getUserId())); receiverCmd.setUserSex(1); - receiverCmd.setActivityType(RankingActivityType.GREEDY_GAME.getCode()); - receiverCmd.setCycleType(RankingCycleType.MONTHLY.getCode()); - receiverCmd.setCycleKey("202511"); + receiverCmd.setActivityType(RankingActivityType.KING_GAMES.getCode()); + receiverCmd.setCycleType(RankingCycleType.WEEKLY.getCode()); + receiverCmd.setCycleKey(ZonedDateTimeAsiaRiyadhUtils.nowWeekMondayToInt().toString()); receiverCmd.setDimension(RankingDimension.GAME_WIN.getCode()); receiverCmd.setIncrementQuantity(request.getCurrencyDiff()); receiverCmd.setBizNo(request.getGameRoundId()); diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/HotGameServiceImpl.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/HotGameServiceImpl.java index fd015a3c..a42d2f37 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/HotGameServiceImpl.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/HotGameServiceImpl.java @@ -13,20 +13,26 @@ 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; import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.framework.core.dto.ReqSysOrigin; import com.red.circle.framework.core.exception.ResponseException; import com.red.circle.framework.core.security.UserCredential; import com.red.circle.mq.business.model.event.task.TaskApprovalEvent; import com.red.circle.mq.rocket.business.producer.TaskMqMessage; import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; import com.red.circle.other.app.dto.clientobject.game.HotGameUpdateRequest; +import com.red.circle.other.app.dto.cmd.activity.RankingDataUpdateCmd; import com.red.circle.other.app.dto.cmd.game.GameLxwlUpdateBalanceCmd; import com.red.circle.other.app.enums.violation.GameOriginEnum; +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.util.OfficialNoticeUtils; import com.red.circle.other.domain.game.GameRankingIncrementCmd; import com.red.circle.other.domain.gateway.game.GameRankingGateway; import com.red.circle.other.domain.gateway.user.UserProfileGateway; +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.cache.service.other.GameListCacheService; import com.red.circle.other.infra.database.rds.entity.sys.GameListConfig; @@ -34,6 +40,7 @@ import com.red.circle.other.infra.database.rds.service.sys.GameListConfigService import com.red.circle.other.inner.enums.config.EnumConfigKey; 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.ZonedDateTimeAsiaRiyadhUtils; import com.red.circle.tool.core.json.JacksonUtils; import com.red.circle.tool.core.num.ArithmeticUtils; import com.red.circle.tool.core.parse.DataTypeUtils; @@ -77,6 +84,7 @@ public class HotGameServiceImpl implements HotGameService { private final GameListConfigService gameListConfigService; private final GameRankingGateway gameRankingGateway; private final GameListCacheService gameListCacheService; + private final RankingActivityService rankingActivityService; @Override public HotGameResponse getUserProfile(HotGameUserProfileQuery query) { @@ -209,6 +217,8 @@ public class HotGameServiceImpl implements HotGameService { sendBroadcast(param, gameListConfig); //累计游戏排行榜 incGameRankingRecord(param, gameListConfig); + //游戏参与打榜活动 + incGameRankingActivity(param); return new HotGameResponse() .setData(new HotGameCoin() .setBalanceCoin(res.getBalance().getDollarAmount().longValue()) @@ -247,6 +257,22 @@ public class HotGameServiceImpl implements HotGameService { gameRankingGateway.incrementPrizeAmount(build); } + private void incGameRankingActivity(HotGameUserCoinUpdate param) { + if (param.getCoin() > 0) { + RankingDataUpdateCmd receiverCmd = new RankingDataUpdateCmd(); + receiverCmd.setUserId(DataTypeUtils.toLong(param.getUid())); + receiverCmd.setUserSex(1); + receiverCmd.setActivityType(RankingActivityType.KING_GAMES.getCode()); + receiverCmd.setCycleType(RankingCycleType.WEEKLY.getCode()); + receiverCmd.setCycleKey(ZonedDateTimeAsiaRiyadhUtils.nowWeekMondayToInt().toString()); + receiverCmd.setDimension(RankingDimension.GAME_WIN.getCode()); + receiverCmd.setIncrementQuantity(param.getCoin()); + receiverCmd.setBizNo(param.getGameId()); + receiverCmd.setReqSysOrigin(ReqSysOrigin.of("LIKEI")); + rankingActivityService.accumulateRankingData(receiverCmd); + } + } + private void sendBroadcast(HotGameUserCoinUpdate request, GameListConfig gameListConfig) { if (gameListConfig == null) { return;