From ed2633ac0fd656e05dd65912cb2d2965193c859a Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Tue, 25 Nov 2025 16:53:13 +0800 Subject: [PATCH] =?UTF-8?q?=E7=81=B5=E4=BB=99=E6=B8=B8=E6=88=8F=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E4=B8=AD=E5=A5=96=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../game/party3rd/GameHkysRestController.java | 53 ++++++++++++++++++- 1 file changed, 51 insertions(+), 2 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 3be4b2fa..bb53377d 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 @@ -1,6 +1,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.hkys.GameHkysService; import com.red.circle.component.game.hkys.props.GameHkysProperties; import com.red.circle.component.game.hkys.request.HkysUserCoinUpdate; @@ -11,16 +12,30 @@ import com.red.circle.component.game.hkys.response.HyksErrorEnum; import com.red.circle.component.game.hkys.response.UpdateUserCoinResponse; import com.red.circle.component.game.hotgame.response.HotGameCoin; 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.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.game.GameLxwlUpdateBalanceCmd; import com.red.circle.other.app.dto.cmd.game.GameLxwlUserInfoCmd; +import com.red.circle.other.app.util.OfficialNoticeUtils; +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; +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.parse.DataTypeUtils; import com.red.circle.tool.core.text.StringUtils; import com.red.circle.tool.crypto.SecurityUtils; + +import java.math.BigDecimal; +import java.util.Map; import java.util.Objects; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -47,6 +62,11 @@ public class GameHkysRestController { private final GameHkysService gameHkysService; private final GameHkysProperties gameHkysProperties; private final TaskMqMessage taskMqMessage; + private final EnumConfigCacheService enumConfigCacheService; + private final UserProfileGateway userProfileGateway; + private final UserProfileAppConvertor userProfileAppConvertor; + private final GameListConfigService gameListConfigService; + private final ImGroupClient imGroupClient; @IgnoreResultResponse @PostMapping("/getUserInfo") @@ -104,7 +124,36 @@ public class GameHkysRestController { //游玩一句游戏结束 每日任务 灵仙 Long userId = DataTypeUtils.toLong(cmd.getUid()); - taskMqMessage.sendTask(TaskApprovalEvent.builder() + + String sysOrigin = UserCredential.parseToken(cmd.getToken()).getSysOrigin(); + + BigDecimal cost = enumConfigCacheService + .getValueBigDecimal(EnumConfigKey.GAME_BROADCAST_AMOUNT, sysOrigin) ; + if (cost == null || cost.compareTo(BigDecimal.ZERO) <= 0) { + cost = BigDecimal.valueOf(5000L); + } + + if (cmd.getType() != null && cmd.getType() == 2 && cmd.getCoin() >= cost.longValue()) { + UserProfileDTO userProfile = userProfileAppConvertor.toUserProfileDTO( + userProfileGateway.getByUserId(userId)); + + GameListConfig gameListConfig = gameListConfigService.getByGameId(cmd.getGameId(), sysOrigin); + if (Objects.nonNull(gameListConfig)) { + Map build = OfficialNoticeUtils.buildUserProfile(userProfile); + build.put("gameUrl", gameListConfig.getCover()); + build.put("currencyDiff", cmd.getCoin()); + + imGroupClient.sendMessageBroadcast( + BroadcastGroupMsgBodyCmd.builder() + .toPlatform(SysOriginPlatformEnum.LIKEI) + .type(GroupMessageTypeEnum.GAME_BAISHUN_WIN) + .data(build) + .build() + ); + } + } + + /*taskMqMessage.sendTask(TaskApprovalEvent.builder() .taskId(4) .userId(userId) .day(LocalDateTimeUtils.nowFormat("yyyy-MM-dd")) @@ -112,7 +161,7 @@ public class GameHkysRestController { .sysOrigin(UserCredential.parseToken(cmd.getToken()).getSysOrigin()) .gameName(GoldOrigin.HKYS_GAME.name()) .gameId(Long.parseLong(cmd.getGameId())) - .build()); + .build());*/ return new HkysResponse() .setErrorCode(HyksErrorEnum.SUCCESS.getErrorCode()) .setData(jsonObject);