灵仙游戏新增中奖通知

This commit is contained in:
tianfeng 2025-11-25 16:53:13 +08:00
parent 8408137bc7
commit ed2633ac0f

View File

@ -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<Object, Object> 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<JSONObject>()
.setErrorCode(HyksErrorEnum.SUCCESS.getErrorCode())
.setData(jsonObject);