新增普通用户送礼物比例
This commit is contained in:
parent
cf6277667e
commit
d7c5553b9b
@ -33,6 +33,16 @@ public enum RegionAssistTypeEnum {
|
||||
*/
|
||||
GIFT_TO_OTHER_GOLD_RATIO_AGENCY("接收他人礼物获得金币比例(%)-代理"),
|
||||
|
||||
/**
|
||||
* 接收自己礼物获得金币比例(%).普通用户
|
||||
*/
|
||||
GIFT_TO_OWN_GOLD_RATIO_NORMAL("接收自己礼物获得金币比例(%)-普通用户"),
|
||||
|
||||
/**
|
||||
* 接收他人礼物获得金币比例(%).普通用户
|
||||
*/
|
||||
GIFT_TO_OTHER_GOLD_RATIO_NORMAL("接收他人礼物获得金币比例(%)-普通用户"),
|
||||
|
||||
/**
|
||||
* 接收礼物获得目标比例(%).
|
||||
*/
|
||||
|
||||
@ -522,8 +522,8 @@ public class GiveGiftsListener implements MessageListener {
|
||||
acceptRegion.getRegionCode()), Boolean.TRUE);
|
||||
if (Boolean.FALSE.equals(isConflicts)) {
|
||||
|
||||
// 幸运礼物
|
||||
if (event.checkLuckyGift()) {
|
||||
// 幸运礼物 不计算金额,GiftPrizeAcceptStrategy不发送
|
||||
/*if (event.checkLuckyGift()) {
|
||||
|
||||
// 幸运礼物目标 = 礼物价值 * 比例
|
||||
targetAmount = giftValue.getGiftValue().multiply(luckyGiftRatio).setScale(0, RoundingMode.DOWN);
|
||||
@ -532,14 +532,24 @@ public class GiveGiftsListener implements MessageListener {
|
||||
// 赠送礼物给别人返还金币比例
|
||||
acceptAssistRatio = luckyGiftRatio;
|
||||
|
||||
} else {
|
||||
}*/
|
||||
|
||||
if (!event.checkLuckyGift()) {
|
||||
// 赠送礼物给别人返还金币比例
|
||||
acceptAssistRatio = getAssistGiftToOtherGoldRatio(acceptRegion.getId());
|
||||
|
||||
// 发送人是普通用户
|
||||
BigDecimal sendAssistRatioNormal = null;
|
||||
if (userRegionGateway.isOrdinaryUser(event.getSendUserId())) {
|
||||
acceptAssistRatio = getAssistGiftToOtherGoldRatioNormal(acceptRegion.getId());
|
||||
sendAssistRatioNormal = getAssistGiftToOwnGoldRatioNormal(acceptRegion.getId());
|
||||
|
||||
}
|
||||
|
||||
// 普通礼物,接受人可获得金额
|
||||
acceptAmount = enumConfigCacheService.giftGoldRatioFormula(Objects.equals(event.getSendUserId(), accept.getAcceptUserId())
|
||||
? sendAssistRatio : acceptAssistRatio, giftValue.getGiftValue());
|
||||
? (sendAssistRatioNormal != null ? sendAssistRatioNormal : sendAssistRatio)
|
||||
: acceptAssistRatio, giftValue.getGiftValue());
|
||||
|
||||
BigDecimal assistGiftTargetRatio = getAssistGiftTargetRatio(acceptRegion.getId());
|
||||
|
||||
@ -840,6 +850,20 @@ public class GiveGiftsListener implements MessageListener {
|
||||
return userRegionGateway.getAssistGiftToOwnGoldRatioAgency(regionId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 赠送礼物给别人返还金币比例-普通用户
|
||||
*/
|
||||
private BigDecimal getAssistGiftToOtherGoldRatioNormal(String regionId) {
|
||||
return userRegionGateway.getAssistGiftToOtherGoldRatioNormal(regionId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 赠送礼物给自己返还金币比例-普通用户
|
||||
*/
|
||||
private BigDecimal getAssistGiftToOwnGoldRatioNormal(String regionId) {
|
||||
return userRegionGateway.getAssistGiftToOwnGoldRatioNormal(regionId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 接收礼物获得目标比例.
|
||||
*/
|
||||
|
||||
@ -52,6 +52,11 @@ public interface UserRegionGateway {
|
||||
*/
|
||||
boolean checkBusinessRegion(Long userId, Long compareUserId);
|
||||
|
||||
/**
|
||||
* 是否普通用户
|
||||
* true: team_member没有用户信息
|
||||
*/
|
||||
boolean isOrdinaryUser(Long userId);
|
||||
|
||||
/**
|
||||
* 检查两个code在业务分区是否一致.
|
||||
@ -87,6 +92,16 @@ public interface UserRegionGateway {
|
||||
|
||||
BigDecimal getAssistGiftToOwnGoldRatioAgency(String regionId);
|
||||
|
||||
/**
|
||||
* 接收他人礼物获得金币比例-普通用户
|
||||
*/
|
||||
BigDecimal getAssistGiftToOtherGoldRatioNormal(String regionId);
|
||||
|
||||
/**
|
||||
* 接收自己礼物获得金币比例-普通用户
|
||||
*/
|
||||
BigDecimal getAssistGiftToOwnGoldRatioNormal(String regionId);
|
||||
|
||||
BigDecimal getGiftToOtherDiamondRatio(String regionId,Boolean isHost);
|
||||
|
||||
/**
|
||||
|
||||
@ -332,6 +332,11 @@ public class UserRegionGatewayImpl implements UserRegionGateway {
|
||||
return checkBusinessRegionCode(regionOne, regionTwo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOrdinaryUser(Long userId) {
|
||||
return teamMemberService.getByMemberId(userId) == null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查两个code在业务分区是否一致.
|
||||
* <p>在一些特效情况下, 运营对当前区域进行整合, 如: 阿拉伯+土耳其可以互相访问</p>
|
||||
@ -517,6 +522,38 @@ public class UserRegionGatewayImpl implements UserRegionGateway {
|
||||
defaultRatio);
|
||||
}
|
||||
|
||||
/**
|
||||
* 接收他人礼物获得金币比例.代理
|
||||
*/
|
||||
@Override
|
||||
public BigDecimal getAssistGiftToOtherGoldRatioNormal(String regionId) {
|
||||
|
||||
BigDecimal defaultRatio = BigDecimal.valueOf(0.1);
|
||||
if (StringUtils.isBlank(regionId)) {
|
||||
return defaultRatio;
|
||||
}
|
||||
|
||||
return getAssistRatio(sysRegionAssistConfigService
|
||||
.getRegionAssistConfig(RegionAssistTypeEnum.GIFT_TO_OTHER_GOLD_RATIO_NORMAL, regionId),
|
||||
defaultRatio);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 接收自己礼物获得金币比例.
|
||||
*/
|
||||
@Override
|
||||
public BigDecimal getAssistGiftToOwnGoldRatioNormal(String regionId) {
|
||||
BigDecimal defaultRatio = BigDecimal.valueOf(0.1);
|
||||
if (StringUtils.isBlank(regionId)) {
|
||||
return defaultRatio;
|
||||
}
|
||||
|
||||
return getAssistRatio(sysRegionAssistConfigService
|
||||
.getRegionAssistConfig(RegionAssistTypeEnum.GIFT_TO_OWN_GOLD_RATIO_NORMAL, regionId),
|
||||
defaultRatio);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal getGiftToOtherDiamondRatio(String regionId,Boolean isHost) {
|
||||
BigDecimal defaultRatio = BigDecimal.valueOf(0.1);
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import com.red.circle.tool.crypto.SecurityUtils;
|
||||
import org.junit.Test;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
|
||||
@ -8,5 +9,10 @@ public class ApiTest {
|
||||
System.out.println(new BCryptPasswordEncoder().encode("8826681"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test1() {
|
||||
System.out.println(SecurityUtils.md5("1957345312961527809"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user