CP礼物增加心动值处理
This commit is contained in:
parent
bbc48bb206
commit
22690760fd
@ -237,6 +237,14 @@ public class GiveAwayGiftBatchEvent implements Serializable {
|
||||
return Objects.nonNull(giftConfig) && Objects.equals(giftConfig.getGiftTab(), "LUCKY_GIFT");
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是CP礼物.
|
||||
*/
|
||||
public boolean checkCpGift() {
|
||||
return Objects.nonNull(giftConfig) && Objects.equals(giftConfig.getGiftTab(), "CP");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 是否是专属礼物.
|
||||
*/
|
||||
|
||||
@ -43,6 +43,11 @@ public enum RegionAssistTypeEnum {
|
||||
*/
|
||||
GIFT_TO_OTHER_GOLD_RATIO_NORMAL("接收他人礼物获得金币比例(%)-普通用户"),
|
||||
|
||||
/**
|
||||
* CP礼物返还金币比例
|
||||
*/
|
||||
CP_GIFT_GOLD_RATIO("CP礼物返还金币比例"),
|
||||
|
||||
/**
|
||||
* 接收礼物获得目标比例(%).
|
||||
*/
|
||||
|
||||
@ -55,6 +55,7 @@ import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManager
|
||||
import com.red.circle.other.infra.database.mongo.service.team.team.TeamBillCycleService;
|
||||
import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberService;
|
||||
import com.red.circle.other.infra.database.mongo.service.team.team.TeamPolicyManagerService;
|
||||
import com.red.circle.other.inner.enums.config.EnumConfigKey;
|
||||
import com.red.circle.other.inner.enums.material.GiftSpecialEnum;
|
||||
import com.red.circle.other.inner.enums.team.TeamPolicyTypeEnum;
|
||||
import com.red.circle.other.inner.model.dto.activity.props.ActivityRewardPropsDTO;
|
||||
@ -522,6 +523,13 @@ public class GiveGiftsListener implements MessageListener {
|
||||
acceptAssistRatio = luckyGiftRatio;
|
||||
targetAmount = giftValue.getGiftValue().multiply(luckyGiftRatio).setScale(0, RoundingMode.DOWN);
|
||||
acceptAmount = targetAmount;
|
||||
|
||||
} else if (event.checkCpGift()){
|
||||
// CP礼物
|
||||
acceptAssistRatio = getAssistCpGiftGoldRatio(acceptRegion.getId());
|
||||
targetAmount = giftValue.getGiftValue().multiply(acceptAssistRatio.multiply(new BigDecimal("10").max(new BigDecimal("0.7")))).setScale(0, RoundingMode.DOWN);
|
||||
acceptAmount = giftValue.getGiftValue().multiply(acceptAssistRatio).setScale(0, RoundingMode.DOWN);
|
||||
|
||||
} else {
|
||||
// 普通礼物
|
||||
acceptAssistRatio = calculateAcceptAssistRatio(event, acceptRegion);
|
||||
@ -699,6 +707,13 @@ public class GiveGiftsListener implements MessageListener {
|
||||
return userRegionGateway.getAssistGiftToOwnGoldRatioNormal(regionId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 赠送CP礼物返还金币比例
|
||||
*/
|
||||
private BigDecimal getAssistCpGiftGoldRatio(String regionId) {
|
||||
return userRegionGateway.getAssistCpGiftGoldRatio(regionId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 接收礼物获得目标比例.
|
||||
*/
|
||||
|
||||
@ -85,28 +85,10 @@ public class GiftPrizeAcceptStrategy implements GiftStrategy {
|
||||
}
|
||||
|
||||
// 当前礼物是否为幸运礼物
|
||||
Boolean isLuckyGift = runningWater.getGiftValue().getGiftType()
|
||||
boolean isLuckyGift = runningWater.getGiftValue().getGiftType()
|
||||
.contains(GiftTabEnum.LUCKY_GIFT.name());
|
||||
|
||||
// YOLO任何礼物改为接受钻石
|
||||
/*if (Objects.equals(runningWater.getSysOrigin(), SysOriginPlatformEnum.YOLO.name())
|
||||
&& GiftCurrencyType.GOLD.eq(runningWater.getGiftValue().getCurrencyType())) {
|
||||
yoloSalaryDiamondCount(runningWater, accept);
|
||||
*//*DiamondReceiptCmd cmd = new DiamondReceiptCmd()
|
||||
.setConsumeId(IdWorkerUtils.getIdStr())
|
||||
.setSysOrigin(SysOriginPlatformEnum.valueOf(runningWater.getSysOrigin()))
|
||||
.setTrackId(runningWater.getId())
|
||||
.setUserId(accept.getAcceptUserId())
|
||||
.setOriginUserId(runningWater.getUserId())
|
||||
.setOrigin(DiamondOrigin.ACCEPT_GIFT)
|
||||
.setCustomizeOriginDesc("[" + runningWater.getGiftValue().getGiftType() + "]"
|
||||
+ GoldOrigin.ACCEPT_GIFT.getDesc())
|
||||
.setType(ReceiptType.INCOME)
|
||||
.setAmount(accept.getAcceptAmount())
|
||||
.setCreateTime(TimestampUtils.now());
|
||||
log.warn("cmd" + cmd);
|
||||
walletDiamondClient.changeBalance(cmd);*//*
|
||||
} else{*/
|
||||
boolean isCpGift = runningWater.getGiftValue().getGiftType()
|
||||
.contains(GiftTabEnum.LUCKY_GIFT.name());
|
||||
// 发送金币
|
||||
if (GiftCurrencyType.GOLD.eq(runningWater.getGiftValue().getCurrencyType()) && !isLuckyGift) {
|
||||
|
||||
@ -126,44 +108,6 @@ public class GiftPrizeAcceptStrategy implements GiftStrategy {
|
||||
giftGiveRunningWaterService.updateAcceptUserReceiptId(runningWater.getId(),
|
||||
accept.getAcceptUserId(), consumeId);
|
||||
}
|
||||
|
||||
// 发放幸运礼物钻石
|
||||
/*if (GiftCurrencyType.GOLD.eq(runningWater.getGiftValue().getCurrencyType())
|
||||
&& isLuckyGift) {
|
||||
|
||||
walletDiamondClient.changeBalance(
|
||||
new DiamondReceiptCmd()
|
||||
.setConsumeId(IdWorkerUtils.getIdStr())
|
||||
.setSysOrigin(SysOriginPlatformEnum.valueOf(runningWater.getSysOrigin()))
|
||||
.setTrackId(runningWater.getId())
|
||||
.setUserId(accept.getAcceptUserId())
|
||||
.setOriginUserId(runningWater.getUserId())
|
||||
.setOrigin(DiamondOrigin.ACCEPT_LUCKY_GIFTS)
|
||||
.setCustomizeOriginDesc(DiamondOrigin.ACCEPT_LUCKY_GIFTS.getDesc())
|
||||
.setType(ReceiptType.INCOME)
|
||||
.setAmount(accept.getAcceptAmount())
|
||||
.setCreateTime(TimestampUtils.now())
|
||||
);
|
||||
}*/
|
||||
//}
|
||||
|
||||
// 发放积分
|
||||
// if (GiftCurrencyType.DIAMOND.eq(runningWater.getGiftValue().getCurrencyType())
|
||||
// && Boolean.FALSE.equals(isLuckyGift)) {
|
||||
//
|
||||
// walletRepository.changeDiamondBalanceAsync(
|
||||
// DiamondReceipt.builder()
|
||||
// .consumeId(event.getTrackId() + "_" + accept.getAcceptUserId())
|
||||
// .sysOrigin(SysOriginPlatformEnum.valueOf(runningWater.getSysOrigin()))
|
||||
// .trackId(Long.parseLong(event.getTrackId()))
|
||||
// .userId(accept.getAcceptUserId())
|
||||
// .originUserId(runningWater.getUserId())
|
||||
// .type(ReceiptType.INCOME)
|
||||
// .origin(DiamondOrigin.ACCEPT_GIFT)
|
||||
// .amount(accept.getAcceptAmount())
|
||||
// .createTime(runningWater.getCreateTime())
|
||||
// .build());
|
||||
// }
|
||||
});
|
||||
|
||||
giftGiveRunningWaterService.addLog(runningWater.getId(),
|
||||
|
||||
@ -102,6 +102,11 @@ public interface UserRegionGateway {
|
||||
*/
|
||||
BigDecimal getAssistGiftToOwnGoldRatioNormal(String regionId);
|
||||
|
||||
/**
|
||||
* 赠送CP礼物返还金币比例
|
||||
*/
|
||||
BigDecimal getAssistCpGiftGoldRatio(String regionId);
|
||||
|
||||
BigDecimal getGiftToOtherDiamondRatio(String regionId,Boolean isHost);
|
||||
|
||||
/**
|
||||
|
||||
@ -554,6 +554,21 @@ public class UserRegionGatewayImpl implements UserRegionGateway {
|
||||
defaultRatio);
|
||||
}
|
||||
|
||||
/**
|
||||
* 赠送CP礼物返还金币比例.
|
||||
*/
|
||||
@Override
|
||||
public BigDecimal getAssistCpGiftGoldRatio(String regionId) {
|
||||
BigDecimal defaultRatio = BigDecimal.valueOf(0.07);
|
||||
if (StringUtils.isBlank(regionId)) {
|
||||
return defaultRatio;
|
||||
}
|
||||
|
||||
return getAssistRatio(sysRegionAssistConfigService
|
||||
.getRegionAssistConfig(RegionAssistTypeEnum.CP_GIFT_GOLD_RATIO, regionId),
|
||||
defaultRatio);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal getGiftToOtherDiamondRatio(String regionId,Boolean isHost) {
|
||||
BigDecimal defaultRatio = BigDecimal.valueOf(0.1);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user