diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/PropsErrorCode.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/PropsErrorCode.java index 8e678099..a8166702 100644 --- a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/PropsErrorCode.java +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/PropsErrorCode.java @@ -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; diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/material/PropsPurchasingCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/material/PropsPurchasingCmdExe.java index 513c5f59..afac4ef8 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/material/PropsPurchasingCmdExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/material/PropsPurchasingCmdExe.java @@ -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 origin = getOriginCode(cmd, commodity);