幸运礼物打榜改为中奖后递增
This commit is contained in:
parent
bc76d5d939
commit
f0027998d0
@ -17,13 +17,19 @@ import com.red.circle.external.inner.model.cmd.message.BroadcastGroupMsgBodyCmd;
|
|||||||
import com.red.circle.external.inner.model.cmd.message.CustomGroupMsgBodyCmd;
|
import com.red.circle.external.inner.model.cmd.message.CustomGroupMsgBodyCmd;
|
||||||
import com.red.circle.external.inner.model.enums.message.GroupMessageTypeEnum;
|
import com.red.circle.external.inner.model.enums.message.GroupMessageTypeEnum;
|
||||||
import com.red.circle.framework.core.asserts.ResponseAssert;
|
import com.red.circle.framework.core.asserts.ResponseAssert;
|
||||||
|
import com.red.circle.framework.core.dto.ReqSysOrigin;
|
||||||
import com.red.circle.mq.business.model.event.gift.GameLuckyGiftBusinessEvent;
|
import com.red.circle.mq.business.model.event.gift.GameLuckyGiftBusinessEvent;
|
||||||
import com.red.circle.mq.business.model.event.gift.GameLuckyGiftUser;
|
import com.red.circle.mq.business.model.event.gift.GameLuckyGiftUser;
|
||||||
import com.red.circle.mq.rocket.business.streams.GameLuckyGiftBusinessSink;
|
import com.red.circle.mq.rocket.business.streams.GameLuckyGiftBusinessSink;
|
||||||
import com.red.circle.other.app.convertor.user.UserProfileAppConvertor;
|
import com.red.circle.other.app.convertor.user.UserProfileAppConvertor;
|
||||||
import com.red.circle.other.app.dto.clientobject.game.GameLuckyGiftMsgCO;
|
import com.red.circle.other.app.dto.clientobject.game.GameLuckyGiftMsgCO;
|
||||||
|
import com.red.circle.other.app.dto.cmd.activity.RankingDataUpdateCmd;
|
||||||
import com.red.circle.other.app.dto.cmd.gift.GiveAwayGiftBatchCmd;
|
import com.red.circle.other.app.dto.cmd.gift.GiveAwayGiftBatchCmd;
|
||||||
|
import com.red.circle.other.app.service.activity.RankingActivityService;
|
||||||
import com.red.circle.other.domain.gateway.user.UserProfileGateway;
|
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.config.LuckyGiftApiConfig;
|
import com.red.circle.other.infra.config.LuckyGiftApiConfig;
|
||||||
import com.red.circle.other.infra.database.cache.entity.game.luckgift.GameLuckyGiftConfigCache;
|
import com.red.circle.other.infra.database.cache.entity.game.luckgift.GameLuckyGiftConfigCache;
|
||||||
import com.red.circle.other.infra.database.cache.entity.game.luckgift.GameLuckyGiftInventoryCache;
|
import com.red.circle.other.infra.database.cache.entity.game.luckgift.GameLuckyGiftInventoryCache;
|
||||||
@ -35,7 +41,6 @@ import com.red.circle.other.infra.database.rds.entity.game.GameLuckyGiftCount;
|
|||||||
import com.red.circle.other.infra.database.rds.entity.game.GameLuckyGiftRuleConfig;
|
import com.red.circle.other.infra.database.rds.entity.game.GameLuckyGiftRuleConfig;
|
||||||
import com.red.circle.other.infra.database.rds.entity.game.LuckyGiftProbability;
|
import com.red.circle.other.infra.database.rds.entity.game.LuckyGiftProbability;
|
||||||
import com.red.circle.other.infra.database.rds.entity.game.LuckyGiftProbabilityDetails;
|
import com.red.circle.other.infra.database.rds.entity.game.LuckyGiftProbabilityDetails;
|
||||||
import com.red.circle.other.infra.database.rds.entity.sys.EnumConfig;
|
|
||||||
import com.red.circle.other.infra.database.rds.service.game.GameLuckyGiftCountService;
|
import com.red.circle.other.infra.database.rds.service.game.GameLuckyGiftCountService;
|
||||||
import com.red.circle.other.infra.database.rds.service.game.GameLuckyGiftRuleConfigService;
|
import com.red.circle.other.infra.database.rds.service.game.GameLuckyGiftRuleConfigService;
|
||||||
import com.red.circle.other.infra.database.rds.service.game.LuckyGiftProbabilityDetailsService;
|
import com.red.circle.other.infra.database.rds.service.game.LuckyGiftProbabilityDetailsService;
|
||||||
@ -69,7 +74,6 @@ import lombok.Data;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -96,7 +100,7 @@ public class GameLuckyGiftCommon {
|
|||||||
private final GameLuckyGiftRuleConfigService gameLuckyGiftRuleConfigService;
|
private final GameLuckyGiftRuleConfigService gameLuckyGiftRuleConfigService;
|
||||||
private final LuckyGiftProbabilityDetailsService luckyGiftProbabilityDetailsService;
|
private final LuckyGiftProbabilityDetailsService luckyGiftProbabilityDetailsService;
|
||||||
private final LuckyGiftApiConfig luckyGiftApiConfig;
|
private final LuckyGiftApiConfig luckyGiftApiConfig;
|
||||||
|
private final RankingActivityService rankingActivityService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送幸运礼物抽奖mq.
|
* 发送幸运礼物抽奖mq.
|
||||||
@ -335,11 +339,27 @@ public class GameLuckyGiftCommon {
|
|||||||
// 发送中奖金币
|
// 发送中奖金币
|
||||||
BigDecimal balance = sendGold(param.getUserId(), param.getSysOrigin(), awardAmount);
|
BigDecimal balance = sendGold(param.getUserId(), param.getSysOrigin(), awardAmount);
|
||||||
|
|
||||||
|
getDataUpdateCmd(param.getUserId(), awardAmount);
|
||||||
|
|
||||||
// 发送中奖通知
|
// 发送中奖通知
|
||||||
sendMsg(param, multiple, balance, awardAmount);
|
sendMsg(param, multiple, balance, awardAmount);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void getDataUpdateCmd(Long userId, Long actualAmount) {
|
||||||
|
RankingDataUpdateCmd receiverCmd = new RankingDataUpdateCmd();
|
||||||
|
receiverCmd.setUserId(userId);
|
||||||
|
receiverCmd.setUserSex(1);
|
||||||
|
receiverCmd.setActivityType(RankingActivityType.LUCK_GIFT.getCode());
|
||||||
|
receiverCmd.setCycleType(RankingCycleType.WEEKLY.getCode());
|
||||||
|
receiverCmd.setCycleKey(ZonedDateTimeAsiaRiyadhUtils.nowWeekMondayToInt().toString());
|
||||||
|
receiverCmd.setDimension(RankingDimension.CONSUME_AMOUNT.getCode());
|
||||||
|
receiverCmd.setIncrementQuantity(actualAmount);
|
||||||
|
receiverCmd.setBizNo(IdWorkerUtils.getIdStr());
|
||||||
|
receiverCmd.setReqSysOrigin(ReqSysOrigin.of("LIKEI"));
|
||||||
|
rankingActivityService.accumulateRankingData(receiverCmd);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 开启全部模式的情况下抽奖.
|
* 开启全部模式的情况下抽奖.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -431,8 +431,8 @@ public class RankCountStrategy implements GiftStrategy {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RankingActivityType.LUCK_GIFT == activityType) {
|
if (!activityType.isValid()) {
|
||||||
return Boolean.TRUE.equals(runningWater.getLuckyGift());
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 默认规则
|
// 默认规则
|
||||||
|
|||||||
@ -3,6 +3,9 @@ package com.red.circle.other.domain.ranking;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 排行榜活动类型枚举
|
* 排行榜活动类型枚举
|
||||||
*
|
*
|
||||||
@ -43,6 +46,11 @@ public enum RankingActivityType {
|
|||||||
LUCK_GIFT(9999, "LuckGift", "统计送幸运礼物排行"),
|
LUCK_GIFT(9999, "LuckGift", "统计送幸运礼物排行"),
|
||||||
;
|
;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 无效活动类型列表
|
||||||
|
*/
|
||||||
|
private static final List<RankingActivityType> INVALID_TYPES = Arrays.asList(LUCK_GIFT, GREEDY_GAME);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 类型编码
|
* 类型编码
|
||||||
*/
|
*/
|
||||||
@ -90,7 +98,7 @@ public enum RankingActivityType {
|
|||||||
/**
|
/**
|
||||||
* 判断是否是有效的活动类型
|
* 判断是否是有效的活动类型
|
||||||
*/
|
*/
|
||||||
public static boolean isValid(Integer code) {
|
public boolean isValid() {
|
||||||
return getByCode(code) != null;
|
return !INVALID_TYPES.contains(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user