This commit is contained in:
张良(004796)
2024-04-01 10:28:06 +08:00
parent f08dc9b99c
commit 153041bc16
4 changed files with 6 additions and 1 deletions

View File

@@ -49,6 +49,7 @@ public class ConsumeController {
@Operation(summary = "赠送主播礼物")
@Log(title = "赠送主播礼物", businessType = BusinessType.OTHER, isSaveDb = true)
public R<Void> giveGift(@RequestBody GiveGiftReq query){
query.setFromUserId(LoginHelper.getUserId());
GiftConsumerResp resp = consumerManager.sendGift(query);
return R.ok();
}

View File

@@ -13,6 +13,9 @@ public class GiveGiftReq {
@Schema(description = "类型 1 个人详情页 2.IM页面 3视频页")
private Integer type;
@Schema(hidden = true)
private Long fromUserId;
@Schema(description = "接收方用户ID")
private Long toUserId;

View File

@@ -56,7 +56,7 @@ public class UserGiftServiceImpl extends ServiceImpl<UserGiftMapper, UserGift> i
@Override
@Transactional(rollbackFor = Exception.class)
public GiftConsumerResp giveGift(GiveGiftReq query) {
Long fromUserId = LoginHelper.getUserId();
Long fromUserId = query.getFromUserId();
Gift gift = giftService.getById(query.getGiftId());
if(gift == null){
throw new ServiceException("礼物不存在");

View File

@@ -57,6 +57,7 @@ public class GiftMessageHandler extends AbstractMessageHandle implements IMessag
}
GiveGiftReq giveGiftReq = new GiveGiftReq();
giveGiftReq.setType(3);
giveGiftReq.setFromUserId(fdCtxData.getUserId());
giveGiftReq.setToUserId(fdCtxData.getTarUserId());
giveGiftReq.setGiftId(giftId);
giveGiftReq.setGiftCount(giftCount);