动态礼物保存逻辑修改为不累加

This commit is contained in:
tianfeng 2026-02-04 10:46:37 +08:00
parent c4d17b810f
commit 0af74b179f
3 changed files with 33 additions and 1 deletions

View File

@ -47,6 +47,7 @@ import com.red.circle.other.infra.database.mongo.service.sys.ActivityConfigServi
import com.red.circle.other.infra.database.mongo.service.user.count.UserGuardCountService; import com.red.circle.other.infra.database.mongo.service.user.count.UserGuardCountService;
import com.red.circle.other.infra.database.mongo.service.user.count.WeekFriendshipCardCountService; import com.red.circle.other.infra.database.mongo.service.user.count.WeekFriendshipCardCountService;
import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent; import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent;
import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicGift;
import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicMessage; import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicMessage;
import com.red.circle.other.infra.database.rds.entity.game.GameRoomPkIntegralRecord; import com.red.circle.other.infra.database.rds.entity.game.GameRoomPkIntegralRecord;
import com.red.circle.other.infra.database.rds.entity.game.GameRoomPkRecord; import com.red.circle.other.infra.database.rds.entity.game.GameRoomPkRecord;
@ -755,7 +756,7 @@ public class GiftCountStrategy implements GiftStrategy {
} }
// 保存或更新动态礼物 // 保存或更新动态礼物
dynamicGiftService.saveOrUpdate( dynamicGiftService.save1(
Long.parseLong(runningWater.getDynamicContentId()), Long.parseLong(runningWater.getDynamicContentId()),
runningWater.getGiftId(), runningWater.getGiftId(),
runningWater.getUserId(), runningWater.getUserId(),

View File

@ -29,6 +29,18 @@ public interface DynamicGiftService extends BaseService<DynamicGift> {
void saveOrUpdate(Long dynamicContentId, Long giftId, Long createUser, void saveOrUpdate(Long dynamicContentId, Long giftId, Long createUser,
Integer quantity, String giftUrl, BigDecimal unitPrice); Integer quantity, String giftUrl, BigDecimal unitPrice);
/**
* 保存动态礼物.
* @param dynamicContentId 动态内容ID
* @param giftId 礼物ID
* @param createUser 送礼用户
* @param quantity 数量
* @param giftUrl 礼物URL
* @param unitPrice 单价
*/
void save1(Long dynamicContentId, Long giftId, Long createUser,
Integer quantity, String giftUrl, BigDecimal unitPrice);
/** /**
* 分页查询动态礼物列表按更新时间倒序. * 分页查询动态礼物列表按更新时间倒序.
* *

View File

@ -10,6 +10,8 @@ import java.math.BigDecimal;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.red.circle.tool.core.date.TimestampUtils;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -62,6 +64,23 @@ public class DynamicGiftServiceImpl extends BaseServiceImpl<DynamicGiftDAO, Dyna
} }
} }
@Override
public void save1(Long dynamicContentId, Long giftId, Long createUser,
Integer quantity, String giftUrl, BigDecimal unitPrice) {
// 新增记录
DynamicGift newGift = new DynamicGift();
newGift.setDynamicContentId(dynamicContentId);
newGift.setGiftId(giftId);
newGift.setCreateUser(createUser);
newGift.setGiftQuantity(quantity);
newGift.setGiftUrl(giftUrl);
newGift.setGiftUnitPrice(unitPrice);
newGift.setCreateTime(TimestampUtils.now());
newGift.setUpdateTime(TimestampUtils.now());
save(newGift);
}
@Override @Override
public PageResult<DynamicGift> pageByUpdateTimeDesc(PageQuery pageQuery, Long contentId) { public PageResult<DynamicGift> pageByUpdateTimeDesc(PageQuery pageQuery, Long contentId) {
return query() return query()