动态礼物新增url字段

This commit is contained in:
tianfeng 2026-01-30 18:32:48 +08:00
parent 8970cdb61c
commit 129bbe17a4
7 changed files with 30 additions and 8 deletions

View File

@ -116,6 +116,7 @@ public class DynamicDetailsQryExe {
result.setUserAvatar(baseInfo.getUserAvatar());
result.setUserSex(baseInfo.getUserSex());
result.setUserNickname(baseInfo.getUserNickname());
result.setUserProfile(userProfileAppConvertor.convertToSimpleProfile(baseInfo));
}
private void processTag(DynamicContent dynamic, DynamicListCO result) {

View File

@ -63,6 +63,7 @@ public class DynamicGiftQryExe {
listCO.setDynamicId(gift.getDynamicContentId());
listCO.setGiftId(gift.getGiftId());
listCO.setGiftQuantity(gift.getGiftQuantity());
listCO.setGiftUrl(gift.getGiftUrl());
listCO.setGiftUnitPrice(gift.getGiftUnitPrice());
listCO.setUpdateTime(gift.getUpdateTime());

View File

@ -50,6 +50,8 @@ import com.red.circle.other.infra.database.rds.entity.user.user.CpBlessRecord;
import com.red.circle.other.infra.database.rds.entity.user.user.CpRelationship;
import com.red.circle.other.infra.database.rds.entity.user.user.CpValue;
import com.red.circle.other.infra.database.rds.entity.user.user.FriendshipCard;
import com.red.circle.other.infra.database.rds.service.dynamic.DynamicContentService;
import com.red.circle.other.infra.database.rds.service.dynamic.DynamicGiftService;
import com.red.circle.other.infra.database.rds.service.game.GameRoomPkIntegralRecordService;
import com.red.circle.other.infra.database.rds.service.game.GameRoomPkRecordService;
import com.red.circle.other.infra.database.rds.service.live.RoomContributionBalanceService;
@ -131,8 +133,8 @@ public class GiftCountStrategy implements GiftStrategy {
private final TaskMqMessage taskMqMessage;
private final SpinsUserTaskProgressService spinsUserTaskProgressService;
private final RedisService redisService;
private final com.red.circle.other.infra.database.rds.service.dynamic.DynamicContentService dynamicContentService;
private final com.red.circle.other.infra.database.rds.service.dynamic.DynamicGiftService dynamicGiftService;
private final DynamicContentService dynamicContentService;
private final DynamicGiftService dynamicGiftService;
private static final List<String> inRegionCodes = List.of("IN", "PK", "BD");
private final UserRegionCacheService userRegionCacheService;
@ -737,6 +739,13 @@ public class GiftCountStrategy implements GiftStrategy {
// 获取礼物信息
GiftValue giftValue = runningWater.getGiftValue();
// 获取礼物URL
String giftUrl = null;
GiftConfigDTO cache = cacheGiftConfigManagerService.getById(runningWater.getGiftId());
if (cache != null) {
giftUrl = cache.getGiftPhoto();
}
// 保存或更新动态礼物
dynamicGiftService.saveOrUpdate(
@ -744,13 +753,10 @@ public class GiftCountStrategy implements GiftStrategy {
runningWater.getGiftId(),
runningWater.getUserId(),
giftValue.getQuantity(),
giftUrl,
giftValue.getUnitPrice()
);
log.info("动态礼物保存成功, dynamicContentId={}, giftId={}, userId={}, quantity={}",
runningWater.getDynamicContentId(), runningWater.getGiftId(),
runningWater.getUserId(), giftValue.getQuantity());
} catch (Exception e) {
log.error("处理动态礼物失败", e);
}

View File

@ -47,6 +47,11 @@ public class DynamicGiftListCO extends ClientObject {
*/
private Integer giftQuantity;
/**
* 礼物URL.
*/
private String giftUrl;
/**
* 单个礼物价值.
*/

View File

@ -49,6 +49,12 @@ public class DynamicGift implements Serializable {
@TableField("gift_quantity")
private Integer giftQuantity;
/**
* 礼物URL.
*/
@TableField("gift_url")
private String giftUrl;
/**
* 单个礼物价值.
*/

View File

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

View File

@ -26,7 +26,7 @@ public class DynamicGiftServiceImpl extends BaseServiceImpl<DynamicGiftDAO, Dyna
@Override
@Transactional(rollbackFor = Exception.class)
public void saveOrUpdate(Long dynamicContentId, Long giftId, Long createUser,
Integer quantity, BigDecimal unitPrice) {
Integer quantity, String giftUrl, BigDecimal unitPrice) {
// 查询是否已存在
DynamicGift existing = query()
@ -40,6 +40,7 @@ public class DynamicGiftServiceImpl extends BaseServiceImpl<DynamicGiftDAO, Dyna
if (existing != null) {
// 累加数量
existing.setGiftQuantity(existing.getGiftQuantity() + quantity);
existing.setGiftUrl(giftUrl);
existing.setUpdateTime(now);
existing.setUpdateUser(createUser);
updateSelectiveById(existing);
@ -50,6 +51,7 @@ public class DynamicGiftServiceImpl extends BaseServiceImpl<DynamicGiftDAO, Dyna
newGift.setGiftId(giftId);
newGift.setCreateUser(createUser);
newGift.setGiftQuantity(quantity);
newGift.setGiftUrl(giftUrl);
newGift.setGiftUnitPrice(unitPrice);
newGift.setCreateTime(now);
newGift.setUpdateTime(now);