返回礼物数量

This commit is contained in:
liaozetao
2024-01-03 11:15:28 +08:00
parent b093cf49ce
commit 2845e093b2
2 changed files with 17 additions and 2 deletions

View File

@@ -1096,7 +1096,7 @@ public class GiftSendService extends BaseService {
luckyBagSendService.asyncSaveRecord(luckyBagRecordList);
// 异步飘屏通知
if (!notifyPoolMap.isEmpty()) {
luckyBagSendService.sendLuckyBagMsg(sendUid, room, gift, notifyPoolMap, prizeLevelMap);
luckyBagSendService.sendLuckyBagMsg(sendUid, room, gift, notifyPoolMap, prizeLevelMap, luckyBagRecordList);
}
List<RoomGiftValueVo> giftValueVos = roomGiftValueService.getAllGiftValue(roomUid, recvUids);

View File

@@ -31,6 +31,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
@Service
@@ -58,15 +59,24 @@ public class LuckyBagSendService extends BaseService {
@Autowired
private ApplicationContext applicationContext;
@Async
public void sendLuckyBagMsg(Long sendUid, Room room, Gift luckyBagGift, Map<Integer, Gift> notifyPoolMap, Map<Integer, Integer> prizeLevelMap) {
sendLuckyBagMsg(sendUid, room, luckyBagGift, notifyPoolMap, prizeLevelMap, null);
}
/**
* 福袋礼物飘屏通知
*/
@Async
public void sendLuckyBagMsg(Long sendUid, Room room, Gift luckyBagGift, Map<Integer, Gift> notifyPoolMap, Map<Integer, Integer> prizeLevelMap) {
public void sendLuckyBagMsg(Long sendUid, Room room, Gift luckyBagGift, Map<Integer, Gift> notifyPoolMap, Map<Integer, Integer> prizeLevelMap, List<LuckyBagRecord> luckyBagRecordList) {
Users users = usersService.getUsersByUid(sendUid);
if (null == room || null == users) {
return;
}
Map<Integer, List<LuckyBagRecord>> recordMap = null;
if (luckyBagRecordList != null) {
recordMap = luckyBagRecordList.stream().collect(Collectors.groupingBy(LuckyBagRecord::getGiftId));
}
for (Gift gift : notifyPoolMap.values()) {
luckyBagRecordService.addLuckyRecordBanner(users, room, luckyBagGift, gift);
Integer prizeLevel = prizeLevelMap.get(gift.getGiftId());
@@ -80,6 +90,11 @@ public class LuckyBagSendService extends BaseService {
msgData.put("goldPrice", gift.getGoldPrice());
msgData.put("luckyBagGiftPic", luckyBagGift.getPicUrl());
msgData.put("giftPic", gift.getPicUrl());
int giftNum = 1;
if (recordMap != null && recordMap.containsKey(gift.getGiftId())) {
giftNum = recordMap.get(gift.getGiftId()).stream().mapToInt(LuckyBagRecord::getGiftNum).sum();
}
msgData.put("giftNum", giftNum);
if (prizeLevel >= PrizeLevelEnum.LEVEL_3.getValue() && prizeLevel <= PrizeLevelEnum.LEVEL_5.getValue()) {
// 全服飘屏+小秘书
Attach attach = new Attach();