boom幸运礼物boom比例
This commit is contained in:
@@ -40,6 +40,8 @@ public class GiftMessage extends BaseMqMessage {
|
||||
*/
|
||||
private Integer luckyBagId;
|
||||
|
||||
private Long realGoldNum; // 金币数量 送礼mq消费没有这个字段,在mq消费的时候赋值goldNum 给realGoldNum
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GiftMessage{" +
|
||||
@@ -50,6 +52,7 @@ public class GiftMessage extends BaseMqMessage {
|
||||
", roomUid=" + roomUid +
|
||||
", roomType=" + roomType +
|
||||
", goldNum=" + goldNum +
|
||||
", realGoldNum=" + realGoldNum +
|
||||
", diamondNum=" + diamondNum +
|
||||
", giftId=" + giftId +
|
||||
", giftConsumeType=" + giftConsumeType +
|
||||
|
@@ -50,6 +50,7 @@ public class GiftMessageService extends BaseService {
|
||||
|
||||
long totalGoldNum = giftMessage.getGoldNum();
|
||||
byte giftType = giftMessage.getGiftType();
|
||||
giftMessage.setRealGoldNum(totalGoldNum);
|
||||
if (Constant.GiftType.SUPER_LUCKY == giftType || Constant.GiftType.LUCKY_24 == giftType){
|
||||
giftMessage.setGoldNum(0L);
|
||||
}
|
||||
|
@@ -90,6 +90,10 @@ public class RoomBoomBizService {
|
||||
// 房间
|
||||
private final static Integer EXPIRE_DAY = 2;
|
||||
|
||||
public static final BigDecimal NORMAL_GIFT_BOOM_RATE = BigDecimal.valueOf(1.0D);
|
||||
public static final BigDecimal SUPER_GIFT_BOOM_RATE_AR = BigDecimal.valueOf(0.05D);
|
||||
public static final BigDecimal SUPER_GIFT_BOOM_RATE_EN = BigDecimal.valueOf(0.02D);
|
||||
|
||||
public void handleMessage(GiftMessage giftMessage) {
|
||||
RoomBoomConfig roomBoomConfig = this.roomBoomConfig();
|
||||
if (!roomBoomConfig.getBoomSwitch()) {
|
||||
@@ -98,6 +102,7 @@ public class RoomBoomBizService {
|
||||
Long roomUid = giftMessage.getRoomUid();
|
||||
Integer partitionId = giftMessage.getPartitionId();
|
||||
Long goldNum = giftMessage.getGoldNum();
|
||||
Byte giftType = giftMessage.getGiftType();
|
||||
if (roomUid == null) {
|
||||
return;
|
||||
}
|
||||
@@ -108,16 +113,18 @@ public class RoomBoomBizService {
|
||||
if (PartitionEnum.CHINESS.getId() == partitionId) {
|
||||
return;
|
||||
}
|
||||
if (giftMessage.getGoldNum() <= 0 || Constant.GiftType.LUCKY_24 == giftMessage.getGiftType()
|
||||
|| Constant.GiftType.SUPER_LUCKY == giftMessage.getGiftType()) {
|
||||
return;
|
||||
}
|
||||
List<RoomBoomLevel> boomLevelList = roomBoomLevelService.getAllBoomLevel(partitionId);
|
||||
if (CollectionUtils.isEmpty(boomLevelList)) {
|
||||
log.info("Boom玩法等级配置未空...");
|
||||
return;
|
||||
}
|
||||
BigDecimal boomRate = new BigDecimal(1D);
|
||||
if (Constant.GiftType.LUCKY_24 == giftType
|
||||
|| Constant.GiftType.SUPER_LUCKY == giftType) {
|
||||
if (goldNum <= 0) {
|
||||
goldNum = giftMessage.getRealGoldNum();
|
||||
}
|
||||
}
|
||||
BigDecimal boomRate = boomRateStat(partitionId, giftType);
|
||||
Long sendUid = giftMessage.getSendUid();
|
||||
Double addBoomValue = BigDecimal.valueOf(goldNum).multiply(boomRate).doubleValue();
|
||||
ZonedDateTime dateTimeByZoneId = DateTimeUtil.convertWithZoneId(new Date(giftMessage.getMessTime()), partitionInfo.getZoneId());
|
||||
@@ -127,6 +134,19 @@ public class RoomBoomBizService {
|
||||
dealRoomBoomLevelUp(roomUid, sendUid, cycleDate, addBoomValue, boomLevelList, roomBoomConfig, partitionId);
|
||||
}
|
||||
|
||||
private BigDecimal boomRateStat(Integer partitionId, Byte giftType) {
|
||||
BigDecimal boomRate = NORMAL_GIFT_BOOM_RATE;
|
||||
if (Constant.GiftType.LUCKY_24 == giftType
|
||||
|| Constant.GiftType.SUPER_LUCKY == giftType) {
|
||||
if (PartitionEnum.ARAB.getId() == partitionId) {
|
||||
boomRate = SUPER_GIFT_BOOM_RATE_AR;
|
||||
} else if (PartitionEnum.ENGLISH.getId() == partitionId) {
|
||||
boomRate = SUPER_GIFT_BOOM_RATE_EN;
|
||||
}
|
||||
}
|
||||
return boomRate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理boom升级逻辑
|
||||
*
|
||||
@@ -662,4 +682,7 @@ public class RoomBoomBizService {
|
||||
return redissonClient.getList(RoomBoomConstant.RedisKey.room_boom_award_record.getKey(cycleDate, roomUid.toString(), uid.toString()));
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user