diff --git a/app/src/main/java/com/chwl/app/notify/GlobalNotifyManager.kt b/app/src/main/java/com/chwl/app/notify/GlobalNotifyManager.kt index 02564d637..2178a4917 100644 --- a/app/src/main/java/com/chwl/app/notify/GlobalNotifyManager.kt +++ b/app/src/main/java/com/chwl/app/notify/GlobalNotifyManager.kt @@ -29,6 +29,7 @@ import com.chwl.core.im.custom.bean.RoomTemplateNotifyMsgBean import com.chwl.core.manager.AvRoomDataManager import com.chwl.core.manager.IMNetEaseManager import com.chwl.core.noble.bean.AllServiceGiftProtocol +import com.chwl.core.user.UserModel import com.example.lib_utils.log.ILog import com.google.gson.Gson import com.netease.nim.uikit.common.util.sys.ScreenUtil @@ -146,7 +147,9 @@ object GlobalNotifyManager : Observer, ILog { protocol.data.toString(), RoomTemplateNotifyMsgBean::class.java ) - queue.addLast(data) + if (UserModel.get().isSamePartition(data.partitionId ?: 0)) { + queue.addLast(data) + } } } // 礼物 @@ -156,7 +159,9 @@ object GlobalNotifyManager : Observer, ILog { protocol.data.toString(), AllServiceGiftProtocol.DataBean::class.java ) - queue.addLast(data) + if (UserModel.get().isSamePartition(data.partitionId)) { + queue.addLast(data) + } } } // 寻爱之旅 @@ -172,7 +177,9 @@ object GlobalNotifyManager : Observer, ILog { protocol.data.toString(), LuckyBagNoticeInfo::class.java ) - queue.addLast(data) + if (UserModel.get().isSamePartition(data.partitionId)) { + queue.addLast(data) + } } } } @@ -183,6 +190,9 @@ object GlobalNotifyManager : Observer, ILog { protocol.data.toString(), RoomBoxPrizeInfo::class.java ) + if (!UserModel.get().isSamePartition(data.partitionId)) { + return + } val roomBoxPrizeAttachment = RoomBoxPrizeAttachment( CustomAttachment.CUSTOM_MSG_BOX, CustomAttachment.CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA diff --git a/core/src/main/java/com/chwl/core/gift/bean/LuckyBagNoticeInfo.java b/core/src/main/java/com/chwl/core/gift/bean/LuckyBagNoticeInfo.java index 0096378b5..df95ae8a7 100644 --- a/core/src/main/java/com/chwl/core/gift/bean/LuckyBagNoticeInfo.java +++ b/core/src/main/java/com/chwl/core/gift/bean/LuckyBagNoticeInfo.java @@ -16,4 +16,5 @@ public class LuckyBagNoticeInfo implements Serializable { private String luckyBagGiftPic; private String giftPic; private int giftNum; + private long partitionId; } diff --git a/core/src/main/java/com/chwl/core/im/custom/bean/RoomBoxPrizeInfo.java b/core/src/main/java/com/chwl/core/im/custom/bean/RoomBoxPrizeInfo.java index 73c93f093..7b43a5cd3 100644 --- a/core/src/main/java/com/chwl/core/im/custom/bean/RoomBoxPrizeInfo.java +++ b/core/src/main/java/com/chwl/core/im/custom/bean/RoomBoxPrizeInfo.java @@ -11,4 +11,5 @@ public class RoomBoxPrizeInfo { private long roomUid; private int prizeNum; private int userLevelLimit; + private long partitionId; } \ No newline at end of file diff --git a/core/src/main/java/com/chwl/core/im/custom/bean/RoomTemplateNotifyMsgBean.kt b/core/src/main/java/com/chwl/core/im/custom/bean/RoomTemplateNotifyMsgBean.kt index 615641408..f9c91800b 100644 --- a/core/src/main/java/com/chwl/core/im/custom/bean/RoomTemplateNotifyMsgBean.kt +++ b/core/src/main/java/com/chwl/core/im/custom/bean/RoomTemplateNotifyMsgBean.kt @@ -18,6 +18,8 @@ class RoomTemplateNotifyMsgBean : TemplateMessage() { // SVGA-文本的坑位KEY private var svgaTextKey: String? = null + val partitionId: Long? = null + fun getSvgaTextKey(): String { return svgaTextKey ?: "noble_text_tx" } diff --git a/core/src/main/java/com/chwl/core/noble/bean/AllServiceGiftProtocol.java b/core/src/main/java/com/chwl/core/noble/bean/AllServiceGiftProtocol.java index 22b0150c9..2123fbacf 100644 --- a/core/src/main/java/com/chwl/core/noble/bean/AllServiceGiftProtocol.java +++ b/core/src/main/java/com/chwl/core/noble/bean/AllServiceGiftProtocol.java @@ -49,6 +49,16 @@ public class AllServiceGiftProtocol extends BaseProtocol saveArea(String area); + boolean isSamePartition(long partitionId); } diff --git a/core/src/main/java/com/chwl/core/user/UserModel.java b/core/src/main/java/com/chwl/core/user/UserModel.java index 828d6ea39..2e276ae38 100644 --- a/core/src/main/java/com/chwl/core/user/UserModel.java +++ b/core/src/main/java/com/chwl/core/user/UserModel.java @@ -838,6 +838,14 @@ public final class UserModel extends BaseModel implements IUserModel { .compose(RxHelper.handleSchedulers()); } + @Override + public boolean isSamePartition(long partitionId) { + if (currentUserInfo.partitionId == 0) { + return true; + } + return currentUserInfo.partitionId == partitionId; + } + private interface Api { /** * 获取某个用户的用户信息 diff --git a/core/src/main/java/com/chwl/core/user/bean/UserInfo.java b/core/src/main/java/com/chwl/core/user/bean/UserInfo.java index 39c903dcd..3193df0b0 100644 --- a/core/src/main/java/com/chwl/core/user/bean/UserInfo.java +++ b/core/src/main/java/com/chwl/core/user/bean/UserInfo.java @@ -334,6 +334,10 @@ public class UserInfo implements Serializable { @Setter public boolean inOnline; + @Getter + @Setter + public long partitionId; + public UserInfo() { } @@ -366,6 +370,7 @@ public class UserInfo implements Serializable { this.bindType = userInfo.bindType; this.isReview = userInfo.isReview; this.newAvatar = userInfo.newAvatar; + this.partitionId = userInfo.partitionId; } public Location getUserExpand() { @@ -713,6 +718,14 @@ public class UserInfo implements Serializable { this.familyId = familyId; } + public long getPartitionId() { + return partitionId; + } + + public void setPartitionId(long partitionId) { + this.partitionId = partitionId; + } + @Override public String toString() { return "UserInfo{" +