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 f80782b2..8fd62556 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 @@ -2,6 +2,7 @@ package com.red.circle.other.adapter.app.game.party3rd; import com.alibaba.fastjson.JSONObject; import com.red.circle.common.business.core.enums.SysOriginPlatformEnum; +import com.red.circle.component.game.baishun.request.BaishunChangeCurrencyRequest; import com.red.circle.component.game.hkys.GameHkysService; import com.red.circle.component.game.hkys.props.GameHkysProperties; import com.red.circle.component.game.hkys.request.HkysUserCoinUpdate; @@ -26,6 +27,8 @@ 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.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.infra.database.cache.service.other.EnumConfigCacheService; import com.red.circle.other.infra.database.rds.entity.sys.GameListConfig; @@ -71,6 +74,7 @@ public class GameHkysRestController { private final UserProfileAppConvertor userProfileAppConvertor; private final GameListConfigService gameListConfigService; private final ImGroupClient imGroupClient; + private final GameRankingGateway gameRankingGateway; @IgnoreResultResponse @PostMapping("/getUserInfo") @@ -137,10 +141,10 @@ public class GameHkysRestController { cost = BigDecimal.valueOf(5000L); } + GameListConfig gameListConfig = gameListConfigService.getByGameId(cmd.getGameId(), GameOriginEnum.LINGXIAN.name(), sysOrigin); if (cmd.getType() != null && cmd.getType() == 2 && cmd.getCoin() >= cost.longValue()) { UserProfileDTO userProfile = userProfileAppConvertor.toUserProfileDTO( userProfileGateway.getByUserId(userId)); - GameListConfig gameListConfig = gameListConfigService.getByGameId(cmd.getGameId(), GameOriginEnum.LINGXIAN.name(), sysOrigin); if (Objects.nonNull(gameListConfig)) { Map build = OfficialNoticeUtils.buildUserProfile(userProfile); build.put("gameUrl", gameListConfig.getCover()); @@ -156,6 +160,9 @@ public class GameHkysRestController { } } + //累计游戏排行榜 + incGameRankingRecord(cmd, gameListConfig); + /*taskMqMessage.sendTask(TaskApprovalEvent.builder() .taskId(4) .userId(userId) @@ -170,6 +177,23 @@ public class GameHkysRestController { .setData(jsonObject); } + private void incGameRankingRecord(GameLxwlUpdateBalanceCmd request, GameListConfig gameListConfig) { + if (request.getType() != 2 || gameListConfig == null || request.getCoin() <= 0) { + return; + } + + GameRankingIncrementCmd build = GameRankingIncrementCmd.builder() + .gameOrigin(GameOriginEnum.LINGXIAN.name()) + .gameId(gameListConfig.getGameId()) + .gameName(gameListConfig.getName()) + .gameCover(gameListConfig.getCover()) + .sysOrigin(gameListConfig.getSysOrigin()) + .amount(request.getCoin()) + .periodType("ALL") + .build(); + gameRankingGateway.incrementPrizeAmount(build); + } + @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/HotGameServiceImpl.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/HotGameServiceImpl.java index 4311e203..413bc6d4 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 @@ -19,10 +19,13 @@ 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.game.GameLxwlUpdateBalanceCmd; import com.red.circle.other.app.enums.violation.GameOriginEnum; 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.infra.database.cache.service.other.EnumConfigCacheService; import com.red.circle.other.infra.database.rds.entity.sys.GameListConfig; @@ -71,6 +74,7 @@ public class HotGameServiceImpl implements HotGameService { private final TaskMqMessage taskMqMessage; private final ImGroupClient imGroupClient; private final GameListConfigService gameListConfigService; + private final GameRankingGateway gameRankingGateway; @Override public HotGameResponse getUserProfile(HotGameUserProfileQuery query) { @@ -213,6 +217,9 @@ public class HotGameServiceImpl implements HotGameService { String sysOrigin = UserCredential.parseToken(param.getToken()).getSysOrigin(); GameListConfig gameListConfig = gameListConfigService.getByGameId(param.getGameId(), GameOriginEnum.HOTGAME.name(), sysOrigin); sendBroadcast(param, gameListConfig); + + //累计游戏排行榜 + incGameRankingRecord(param, gameListConfig); } catch (Exception e) { log.error("hotgame游戏飘窗推送失败 ex:{}", e.getMessage()); } @@ -221,6 +228,23 @@ public class HotGameServiceImpl implements HotGameService { .setErrorCode(HotGameErrorEnum.SERVER_ERROR.getErrorCode()); } + private void incGameRankingRecord(HotGameUserCoinUpdate request, GameListConfig gameListConfig) { + if (request.getType() != 2 || gameListConfig == null || request.getCoin() <= 0) { + return; + } + + GameRankingIncrementCmd build = GameRankingIncrementCmd.builder() + .gameOrigin(GameOriginEnum.HOTGAME.name()) + .gameId(gameListConfig.getGameId()) + .gameName(gameListConfig.getName()) + .gameCover(gameListConfig.getCover()) + .sysOrigin(gameListConfig.getSysOrigin()) + .amount(request.getCoin()) + .periodType("ALL") + .build(); + gameRankingGateway.incrementPrizeAmount(build); + } + private void sendBroadcast(HotGameUserCoinUpdate request, GameListConfig gameListConfig) { if (gameListConfig == null) { return;