临时测试
This commit is contained in:
@@ -616,6 +616,53 @@ function removeGroupPendingMessage(imService,groupId, message){
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//下面是合并的
|
||||
|
||||
|
||||
//用户
|
||||
function User(id, nickname, avatar) {
|
||||
this.id = id;
|
||||
this.nickname = nickname;
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
//消息
|
||||
function Message(senderUserId, senderNickname, content, type) {
|
||||
this.senderNickname = senderNickname;
|
||||
this.senderUserId = senderUserId;
|
||||
this.content = content;
|
||||
this.type = type
|
||||
}
|
||||
|
||||
//聊天室
|
||||
function Room(id, name, currentUser) {
|
||||
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.currentUser = currentUser;
|
||||
|
||||
this.onlineUsers = {
|
||||
count: 0,
|
||||
users: []
|
||||
};
|
||||
|
||||
this.messages = [];
|
||||
|
||||
this.MessageType = {
|
||||
CHAT: 0,//文字聊天
|
||||
PROP: 1//道具
|
||||
};
|
||||
|
||||
this.Prop = {
|
||||
HEART: 0,//桃心
|
||||
ROCKET: 1//火箭
|
||||
};
|
||||
}
|
||||
|
||||
IMService.prototype.initialWhenNewMessage = function (whenNewMessage) {
|
||||
this.whenNewMessage = whenNewMessage;
|
||||
};
|
||||
@@ -737,6 +784,12 @@ IMService.prototype.subscribePresence = function (roomId) {
|
||||
//订阅聊天室消息
|
||||
IMService.prototype.subscribeRoomMessage = function (room, user) {
|
||||
this.room = new Room(room.id, room.name, user);
|
||||
this.room.onlineUsers = {
|
||||
count: 0,
|
||||
users: []
|
||||
};
|
||||
|
||||
this.room.messages = [];
|
||||
//监听上下线提醒
|
||||
this.listenerGroupPresence();
|
||||
|
||||
@@ -745,8 +798,8 @@ IMService.prototype.subscribeRoomMessage = function (room, user) {
|
||||
//订阅用户上下线事件
|
||||
this.subscribePresence(this.room.id);
|
||||
//订阅聊天室消息
|
||||
this.subscribeRoomMessage(this.room.id);
|
||||
this.im.subscribeGroup([roomId])
|
||||
// this.subscribeRoomMessage(this.room.id);
|
||||
this.im.subscribeGroup(this.room.id)
|
||||
.then(result => {
|
||||
console.log('消息订阅成功')
|
||||
}).catch(e => {
|
||||
|
||||
Reference in New Issue
Block a user