vip购买 新增不可购买低等级vip

This commit is contained in:
tianfeng 2025-09-11 11:53:45 +08:00
parent b46b6cbb05
commit b74144d871
2 changed files with 14 additions and 0 deletions

View File

@ -93,6 +93,10 @@ public enum PropsErrorCode implements IResponseErrorCode {
GAME_FRUIT_OPENED_NOT_SATISFIED(3114,
"The opening of the treasure chest in the Ferris wheel game is not satisfied"),
/**
* 不可购买低等级VIP
*/
PROPS_LOW_LEVEL_ERROR(3115, "Low-level VIPs cannot be purchased"),
;
private final int code;

View File

@ -18,10 +18,13 @@ import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheSe
import com.red.circle.other.infra.database.mongo.entity.live.RoomSetting;
import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService;
import com.red.circle.other.infra.database.rds.service.props.PropsVipActualEquityService;
import com.red.circle.other.inner.asserts.PropsErrorCode;
import com.red.circle.other.inner.endpoint.material.props.PropsNobleVipClient;
import com.red.circle.other.inner.enums.material.NobleVipEnum;
import com.red.circle.other.inner.enums.material.PropsCommodityType;
import com.red.circle.other.inner.model.dto.material.props.NobleVipAbility;
import com.red.circle.other.inner.model.dto.material.props.ProductProps;
import com.red.circle.other.inner.model.dto.material.props.PropsNobleVipAbilityDTO;
import com.red.circle.other.inner.model.dto.material.props.PropsStoreCommodity;
import com.red.circle.tool.core.date.LocalDateTimeUtils;
import com.red.circle.tool.core.date.TimestampUtils;
@ -59,6 +62,7 @@ public class PropsPurchasingCmdExe {
private final RoomProfileManagerService roomProfileManagerService;
private final PropsVipActualEquityService propsVipActualEquityService;
private final TaskMqMessage taskMqMessage;
private final PropsNobleVipClient propsNobleVipClient;
public BigDecimal execute(PropsPurchasingCmd cmd) {
if (cmd.getDays() <= 0) {
@ -203,6 +207,12 @@ public class PropsPurchasingCmdExe {
BigDecimal amount = commodity.calculatePropsPrices(cmd.getDays());
if (Objects.equals(commodity.getPropsType(), PropsCommodityType.NOBLE_VIP)) {
amount = commodity.calculatePropsDiscountPrices(cmd.getDays(), commodity.getDiscount());
PropsNobleVipAbilityDTO propsNobleVipAbilityDTO = propsNobleVipClient.getUserMaxAbilityDTO(cmd.getReqUserId()).getBody();
if (propsNobleVipAbilityDTO != null && propsNobleVipAbilityDTO.getVipLevel() > commodity.getNobleVipAbility().getVipLevel()) {
throw new RuntimeException(PropsErrorCode.PROPS_LOW_LEVEL_ERROR.getMessage());
}
}
ImmutableKeyValuePair<String, String> origin = getOriginCode(cmd, commodity);