送道具校验修复

This commit is contained in:
tianfeng 2025-10-22 15:42:53 +08:00
parent fd28527783
commit 55fe47dd13
2 changed files with 9 additions and 4 deletions

View File

@ -385,7 +385,7 @@ public class ManagerAuthServiceImpl implements ManagerAuthService {
.append(" 赠送 ")
.append(cmd.getPropsId())
.append(" 道具 给 ").append(cmd.getAcceptUserId());
sendTelegram(stringBuilder);
// sendTelegram(stringBuilder);
} catch (Exception e) {
log.error("赠送道具 发送机器人失败", e);
}
@ -436,7 +436,7 @@ public class ManagerAuthServiceImpl implements ManagerAuthService {
.append(" 赠送 ")
.append(cmd.getSpecialAccount())
.append(" 靓号 给 ").append(cmd.getAcceptUserId());
sendTelegram(stringBuilder);
// sendTelegram(stringBuilder);
} catch (Exception e) {
log.error("赠送靓号 发送机器人失败", e);
}

View File

@ -84,7 +84,12 @@ public class PropsBackpackClientServiceImpl implements PropsBackpackClientServic
.gt(PropsBackpack::getExpireTime, TimestampUtils.now())
.list();
if (CollectionUtils.isNotEmpty(list)) {
cmd.setUseProps(Boolean.FALSE);
// 有使用的道具 && 使用的道具和当前道具不同 => 有同类型的旧道具在使用中
boolean anyMatch = list.stream()
.anyMatch(e -> e.getUseProps() && !e.getPropsId().equals(cmd.getPropsId()));
if (anyMatch) {
cmd.setUseProps(Boolean.FALSE);
}
}
PropsBackpack oldpropsBackpack = propsBackpackService.getUserPropsByUserIdByPropsId(cmd.getAcceptUserId(), cmd.getPropsId());
@ -124,7 +129,7 @@ public class PropsBackpackClientServiceImpl implements PropsBackpackClientServic
@NotNull
private static Timestamp getTimestamp(GivePropsBackpackCmd cmd, PropsBackpack oldpropsBackpack) {
Timestamp timestamp = null;
if (oldpropsBackpack == null) {
if (oldpropsBackpack == null || oldpropsBackpack.getExpireTime().before(TimestampUtils.now())) {
timestamp = TimestampUtils.nowPlusDays(cmd.getDays());
} else {
timestamp = TimestampUtils.dateTimePlusDays(oldpropsBackpack.getExpireTime(), cmd.getDays());