新增高等级vip自动覆盖佩戴低等级vip
This commit is contained in:
parent
6e77daa61d
commit
c9a031b6c2
@ -438,38 +438,42 @@ public class UserRunProfileTransportGatewayImpl implements UserRunProfileTranspo
|
|||||||
|
|
||||||
// 2. 检查当前VIP是否过期
|
// 2. 检查当前VIP是否过期
|
||||||
Timestamp now = TimestampUtils.now();
|
Timestamp now = TimestampUtils.now();
|
||||||
if (currentVip != null && currentVip.getExpireTime().after(now)) {
|
if (currentVip == null) {
|
||||||
// 当前VIP未过期,无需切换
|
// 当前VIP未过期,无需切换
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 如果当前VIP已过期,卸下它
|
// 3. 如果当前VIP已过期,卸下它
|
||||||
if (currentVip != null) {
|
if (currentVip.getExpireTime().before(now)) {
|
||||||
propsBackpackService.unloadUseProps(userId, PropsCommodityType.NOBLE_VIP);
|
propsBackpackService.unloadUseProps(userId, PropsCommodityType.NOBLE_VIP);
|
||||||
log.info("用户VIP已过期并卸下, userId={}, propsId={}, expireTime={}",
|
log.info("用户VIP已过期并卸下, userId={}, propsId={}, expireTime={}",
|
||||||
userId, currentVip.getPropsId(), currentVip.getExpireTime());
|
userId, currentVip.getPropsId(), currentVip.getExpireTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. 使用最高等级的可用VIP
|
// 4. 使用最高等级的可用VIP
|
||||||
useMaxNobleVip(userId);
|
useMaxNobleVip(userId, currentVip.getPropsId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 切换到最高等级VIP
|
* 切换到最高等级VIP
|
||||||
*/
|
*/
|
||||||
private void useMaxNobleVip(Long userId) {
|
private void useMaxNobleVip(Long userId, Long currentVipId) {
|
||||||
PropsNobleVipAbilityDTO abilityDTO = propsNobleVipGateway.getUserMaxAbilityDTO(userId);
|
PropsNobleVipAbilityDTO abilityDTO = propsNobleVipGateway.getUserMaxAbilityDTO(userId);
|
||||||
if (Objects.isNull(abilityDTO)) {
|
if (Objects.isNull(abilityDTO)) {
|
||||||
log.info("用户没有可用的VIP道具, userId={}", userId);
|
log.info("用户没有可用的VIP道具, userId={}", userId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Long vipId = abilityDTO.getId();
|
||||||
|
if (Objects.equals(vipId, currentVipId)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
propsBackpackCommon.switchUseProps(userId, abilityDTO.getId());
|
propsBackpackCommon.switchUseProps(userId, vipId);
|
||||||
propsBackpackCommon.switchUseProps(userId, abilityDTO.getAvatarFrameId());
|
propsBackpackCommon.switchUseProps(userId, abilityDTO.getAvatarFrameId());
|
||||||
propsBackpackCommon.switchUseProps(userId, abilityDTO.getDataCardId());
|
propsBackpackCommon.switchUseProps(userId, abilityDTO.getDataCardId());
|
||||||
propsBackpackCommon.switchUseProps(userId, abilityDTO.getCarId());
|
propsBackpackCommon.switchUseProps(userId, abilityDTO.getCarId());
|
||||||
|
|
||||||
log.info("自动切换到最高等级VIP, userId={}, vipId={}", userId, abilityDTO.getId());
|
log.info("自动切换到最高等级VIP, userId={}, vipId={}", userId, vipId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private UsePropsDTO mergeUserUsePropsEntity(
|
private UsePropsDTO mergeUserUsePropsEntity(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user