77 红包非当前房间的不添加。

This commit is contained in:
2025-12-17 09:31:54 +08:00
parent 81b41ef392
commit 90077d24f6
3 changed files with 12 additions and 8 deletions

View File

@@ -50,15 +50,16 @@ public class QXRedPacketManager {
*
* @param redPackets 红包模型列表
*/
public void addRedPackets(List<RedPacketInfo> redPackets) {
public void addRedPackets(String roomId,List<RedPacketInfo> redPackets) {
if (redPackets == null || redPackets.isEmpty()) {
return;
}
this.redPackets.entrySet().removeIf(entry ->
!(entry.getValue().getRoom_id()+"").equals(roomId));
for (RedPacketInfo model : redPackets) {
this.redPackets.put(model.getRedpacket_id(), model);
}
// 在添加数据后启动定时器(如果尚未启动)
startCheckTimer();
if (this.delegate != null && this.delegate instanceof QXRedPacketManagerDelegate) {
@@ -71,11 +72,12 @@ public class QXRedPacketManager {
*
* @param redPacket 红包模型
*/
public void addRedPacket(RedPacketInfo redPacket) {
public void addRedPacket(String roomId,RedPacketInfo redPacket) {
if (redPacket == null || redPacket.getRedpacket_id() == null) {
return;
}
this.redPackets.entrySet().removeIf(entry ->
!(entry.getValue().getRoom_id()+"").equals(roomId));
this.redPackets.put(redPacket.getRedpacket_id(), redPacket);
// 在添加数据后启动定时器(如果尚未启动)