diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/props/PropsBackpackService.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/props/PropsBackpackService.java index 1ef72306..2dd394bc 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/props/PropsBackpackService.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/props/PropsBackpackService.java @@ -86,6 +86,15 @@ public interface PropsBackpackService extends BaseService { */ PropsBackpack getUserNotExpiredUseProps(Long userId, PropsCommodityType type); + /** + * 获取佩戴的道具. + * + * @param userId 用户id + * @param type 道具类型 + * @return ignore + */ + PropsBackpack getUserUseProps(Long userId, PropsCommodityType type); + /** * 获取用户资源信息. * diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/props/impl/PropsBackpackServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/props/impl/PropsBackpackServiceImpl.java index b92572c3..295566a1 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/props/impl/PropsBackpackServiceImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/props/impl/PropsBackpackServiceImpl.java @@ -139,6 +139,17 @@ public class PropsBackpackServiceImpl extends .getOne(); } + @Override + public PropsBackpack getUserUseProps(Long userId, PropsCommodityType type) { + return query() + .eq(PropsBackpack::getUserId, userId) + .eq(PropsBackpack::getType, type) + .eq(PropsBackpack::getUseProps, Boolean.TRUE) + .orderByDesc(PropsBackpack::getExpireTime) + .last(PageConstant.LIMIT_ONE) + .getOne(); + } + @Override public PropsBackpack getUserProps(Long userId, Long propsId, PropsCommodityType type) { return query() diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/UserRunProfileTransportGatewayImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/UserRunProfileTransportGatewayImpl.java index 7e44ed40..1a90c7ea 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/UserRunProfileTransportGatewayImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/UserRunProfileTransportGatewayImpl.java @@ -434,7 +434,7 @@ public class UserRunProfileTransportGatewayImpl implements UserRunProfileTranspo } // 1. 查询当前正在使用的VIP - PropsBackpack currentVip = propsBackpackService.getUserNotExpiredUseProps(userId, PropsCommodityType.NOBLE_VIP); + PropsBackpack currentVip = propsBackpackService.getUserUseProps(userId, PropsCommodityType.NOBLE_VIP); // 2. 检查当前VIP是否过期 Timestamp now = TimestampUtils.now();