groupManage
groupManage
群管理
- groupManage
- .asyncGetGroupInfo(group_id, froce) ⇒
Promise.<GroupInfoAndSettings>
- .asyncGetJoinedGroups(froce) ⇒
Promise.<Array.<number>>
- .openGroup(group_id)
- .getAllGroupDetail() ⇒
Object.<number, module:types~GroupInfoAndSettings>
- .asyncGetGroupMembers(group_id) ⇒
Promise.<Array.<number>>
- .getGroupMembers(group_id) ⇒
Array.<GroupMember>
- .asyncGetGroupListDetail(gids) ⇒
Promise.<Array.<module:types~BriefGroupInfoAndSettings>>
- .getGruopMessage(gid) ⇒
Array.<Meta>
- .asyncGetInfo(params) ⇒
Promise.<GroupInfoAndSettings>
- .asyncGetMemberList(param) ⇒
Promise.<Array.<module:types~GroupMember>>
- .readGroupMessage(group_id, mid)
- .recallMessage(uid, mid)
- .appendMessageContent(uid, mid, content)
- .replaceMessage(uid, mid, content, config, ext)
- .getUnreadCount(gid) ⇒
number
- .asyncGetAdminList(params) ⇒
Promise.<Array.<module:types~GroupMember>>
- .asyncAdminAdd(params) ⇒
Promise.<Array.<module:types~GroupUserRelationResponse>>
- .asyncAdminRemove(params) ⇒
Promise.<Array.<module:types~GroupUserRelationResponse>>
- .asyncGetAnouncementById(params) ⇒
Promise.<GroupAnnouncement>
- .asyncAnouncementDelete(params) ⇒
Promise.<boolean>
- .asyncAnnouncementEdit(params) ⇒
Promise.<GroupAnnouncement>
- .asyncGetAnnouncementList(params) ⇒
Promise.<Array.<module:types~GroupAnnouncement>>
- .asyncCreate(params) ⇒
Promise.<GroupInfoAndSettings>
- .asyncDestroy(params) ⇒
Promise.<boolean>
- .asyncUpdateAvatar(params) ⇒
Promise.<boolean>
- .asyncUpdateDescription(params) ⇒
Promise.<boolean>
- .asyncUpdateExt(params) ⇒
Promise.<boolean>
- .asyncUpdateName(params) ⇒
Promise.<boolean>
- .asyncGroupMsgMutemode(params) ⇒
Promise.<boolean>
- .asyncGroupBannedList(params) ⇒
Promise.<Array.<module:types~GroupMemberBanned>>
- .asyncGroupBab(params) ⇒
Promise.<Array.<module:types~GroupUserRelationResponse>>
- .asyncGroupUnban(params) ⇒
Promise.<Array.<module:types~GroupUserRelationResponse>>
- .asyncGetSettings(group_id) ⇒
Promise.<GroupInfoAndSettings>
- .asyncUpdateAllowMemberInvitation(params) ⇒
Promise.<boolean>
- .asyncUpdateAllowMemberModify(params) ⇒
Promise.<boolean>
- .asyncUpdateEnableReadack(params) ⇒
Promise.<boolean>
- .asyncUpdateHistoryVisible(params) ⇒
Promise.<boolean>
- .asyncUpdateRequireadminapproval(params) ⇒
Promise.<boolean>
- .asyncBanAll(params) ⇒
Promise.<GroupBanAllResponse>
- .asyncUnBanAll(params) ⇒
Promise.<boolean>
- .asyncOwnerTransfer(params) ⇒
Promise.<GroupUserRelationResponse>
- .asyncGetUserJoined(params) ⇒
Promise.<Array.<number>>
- .asyncApply(params) ⇒
Promise.<GroupUserRelationResponse>
- .asyncApplyHandle(params) ⇒
Promise.<GroupUserRelationResponse>
- .asyncGroupBockedlist(params) ⇒
Promise.<Array.<module:types~GroupBlockedListItem>>
- .asyncGroupBlock(params) ⇒
Promise.<Array.<module:types~GroupUserRelationResponse>>
- .asyncGroupUnblock(params) ⇒
Promise.<Array.<module:types~GroupUserRelationResponse>>
- .asyncKick(params) ⇒
Promise.<Array.<module:types~GroupUserRelationResponse>>
- .asyncGetInvitationList() ⇒
Promise.<Array.<module:types~GroupInvitation>>
- .asyncInvite(params) ⇒
Promise.<Array.<module:types~GroupUserRelationResponse>>
- .asyncInviteHandle(params) ⇒
Promise.<boolean>
- .asyncGetMemberDisplayName(params) ⇒
Promise.<Array.<module:types~GroupMember>>
- .asyncLeave(params) ⇒
Promise.<boolean>
- .asyncUpdateDisplayName(params) ⇒
Promise.<boolean>
- .asncGetApplicationList(params) ⇒
Promise.<Array.<module:types~GroupApplication>>
- .asyncGetFileList(params) ⇒
Promise.<Array.<module:types~GroupSharedFile>>
- .asyncFileDelete(params) ⇒
Promise.<Array.<module:types~GroupSharedFileResponse>>
- .asyncFileUpload(params) ⇒
Promise.<Array.<module:types~GroupSharedFile>>
- .asyncGetGroupInfo(group_id, froce) ⇒
groupManage.asyncGetGroupInfo(group_id, froce) ⇒ Promise.<GroupInfoAndSettings>
获取群信息
Kind: static method of groupManage
Returns: Promise.<GroupInfoAndSettings>
- 群信息
Param | Type | Description |
---|---|---|
group_id | number |
群ID |
froce | boolean |
是否强制从服务器拉取: true - 从服务器拉取, false - 优先从本地存储获取 |
Example
const { rootState, state } = context;
rootState.im.groupManage.asyncGetGroupInfo(state.sid).then((res) => {
context.commit('setGroupInfo', res);
});
groupManage.asyncGetJoinedGroups(froce) ⇒ Promise.<Array.<number>>
获取加入的群组
Kind: static method of groupManage
Returns: Promise.<Array.<number>>
- 群组ID列表
Param | Type | Description |
---|---|---|
froce | boolean |
是否强制从服务器拉取: true - 从服务器拉取, false - 优先从本地存储获取 |
Example
this.im.groupManage.asyncGetJoinedGroups().then((res) => {
const group_list = res.map((item) => item.group_id || item);
this.im.groupManage.asncGetApplicationList({ group_list }).then((rs) => {
this.prepareNotice(rs);
});
});
rootState.im.groupManage.asyncGetJoinedGroups().then((res) => {
const retObj = res.map((i) => {
const unreadCount = rootState.im.groupManage.getUnreadCount(i.group_id);
i.avatar = rootState.im.sysManage.getImage({
avatar: i.avatar,
type: 'group'
});
return Object.assign(
{
unreadCount
},
i
);
});
context.commit('setGroupList', retObj);
contactRequestFlag.rosterList = false;
});
rootState.im.rosterManage.asyncGetRosterIdList().then((res) => {
rootState.im.rosterManage.asnycGetRosterListDetailByIds(res).then(() => {
const allMaps = rootState.im.rosterManage.getAllRosterDetail() || {};
const retObj = res.map((i) => {
const rosterInfo = allMaps[i] || { user_id: i };
return {
name: rosterInfo.nick_name || rosterInfo.username || rosterInfo.user_id,
id: rosterInfo.user_id,
avatar: rootState.im.sysManage.getImage({
avatar: rosterInfo.avatar
})
};
});
context.commit('setRosterList', [].concat(retObj));
});
});
rootState.im.groupManage.asyncGetJoinedGroups(/**true**/).then((res) => {
res = res || [];
const retObj = res.map((i) => {
return {
name: i.name,
id: i.group_id,
avatar: rootState.im.sysManage.getImage({
...
groupManage.openGroup(group_id)
打开群组, 此方法会准备群组聊天界面的一些必备信息。
Kind: static method of groupManage
Param | Type | Description |
---|---|---|
group_id | number |
群组ID |
Example
const { rootState, state } = context;
rootState.im.groupManage.openGroup(state.sid);
//rootState.im.groupManage.readGroupMessage(state.sid);
rootState.im.groupManage
.asyncGetAdminList({ group_id: state.sid })
.then((res) => {
context.commit('setAdminList', res);
})
.catch((err) => {
console.error('Failed to GetAdminList, error:', err);
});
rootState.im.groupManage
.asyncGetGroupInfo(state.sid, true)
.then((res) => {
context.commit('setGroupInfo', res);
})
.catch((err) => {
console.error('Failed to GetGroupInfo, error:', err);
});
const { rootState } = context;
rootState.im.groupManage.openGroup(x.sid);
//rootState.im.groupManage.readGroupMessage(x.sid);
rootState.im.groupManage
.asyncGetAdminList({ group_id: x.sid })
.then((res) => {
context.commit('setAdminList', res);
})
.catch((err) => {
console.error('Failed to GetAdminList, error:', err);
});
rootState.im.groupManage
.asyncGetGroupInfo(x.sid, true)
.then((res) => {
context.commit('setGroupInfo', res);
})
.catch((err) => {
console.error('Failed to GetGroupInfo, error:', err);
});
groupManage.getAllGroupDetail() ⇒ Object.<number, module:types~GroupInfoAndSettings>
获取缓存的所有群组详情
Kind: static method of groupManage
Returns: Object.<number, module:types~GroupInfoAndSettings>
- 群组详情
Example
const rmap = this.im.rosterManage.getAllRosterDetail();
const gmap = this.im.groupManage.getAllGroupDetail();
const sret = applicationlist.map((item) => {
const { status, group_id, applicant_id, expired_time, reason } = item;
const suser = rmap[applicant_id] || {};
const user_name = suser.nick_name || suser.username || item.inviter_id;
const sgroup = gmap[group_id] || {};
const group_name = sgroup.name || item.group_id;
return {
user_name,
group_name,
group_id,
expired_time,
applicant_id,
status,
reason
};
});
this.notices = sret;
const allRosterMap = this.im.rosterManage.getAllRosterDetail();
const allGroupMap = this.im.groupManage.getAllGroupDetail();
const rosterIds = [];
const groupIds = [];
applicationlist.forEach((x) => {
const { inviter_id, group_id } = x;
if (allRosterMap[inviter_id] && allRosterMap[inviter_id].username) {
//
} else {
rosterIds.push(inviter_id);
}
if (!allGroupMap[group_id]) {
groupIds.push(group_id);
}
});
const promistAllAarr = [];
if (groupIds.length) {
promistAllAarr.push(this.im.groupManage.asyncGetGroupListDetail(groupIds));
}
if (groupIds.length) {
promistAllAarr.push(this.im.rosterManage.asnycGetRosterListDetailByIds(rosterIds));
}
if (promistAllAarr.length) {
Promise.all(promistAllAarr).then(() => {
this.dealNoticeList(applicationlist);
});
} else {
this.dealNoticeLis...
const rmap = this.im.rosterManage.getAllRosterDetail();
const gmap = this.im.groupManage.getAllGroupDetail();
const sret = applicationlist.map((item) => {
const { group_id, inviter_id, expired_time, status } = item;
const suser = rmap[inviter_id] || {};
const user_name = suser.nick_name || suser.username || item.inviter_id;
const sgroup = gmap[group_id] || {};
const group_name = sgroup.name || item.group_id;
return {
user_name,
group_name,
group_id,
expired_time,
user_id: inviter_id,
status
};
});
this.notices = sret;
const { rootState } = context;
const convlist = rootState.im.userManage.getConversationList();
const allGroupMap = rootState.im.groupManage.getAllGroupDetail();
const allRosterMap = rootState.im.rosterManage.getAllRosterDetail() || {};
let totalUnreadCount = 0;
const convData = convlist.map((item, index) => {
let name;
const id = item.id;
const content = item.content;
const timestamp = item.timestamp;
const hasAt = item.hasAt;
// const img = allRosterMap[id] && allRosterMap[id].avatar;
let avatar = ''; //(img && this.client.signatureUrl(img, { expires: 600, process: 'image/resize,w_50' })) || '/image/roster.png';
const unreadCount = item.type == 'roster' ? rootState.im.rosterManage.getUnreadCount(id) : rootState.im.groupManage.getUnreadCount(id);
const unread = unreadCount > 0 ? unreadCount : 0;
totalUnreadCount += unread;
if (item.type === 'roster') {
//roster
const sroster =...
groupManage.asyncGetGroupMembers(group_id) ⇒ Promise.<Array.<number>>
获取群组成员ID列表(异步)
Kind: static method of groupManage
Returns: Promise.<Array.<number>>
- 群成员ID列表
Param | Type | Description |
---|---|---|
group_id | number |
群组ID |
Example
groupManage.getGroupMembers(group_id) ⇒ Array.<GroupMember>
获取群组成员(同步)
Kind: static method of groupManage
Returns: Array.<GroupMember>
- 群成员列表
Param | Type | Description |
---|---|---|
group_id | number |
群组ID |
Example
const { rootState, state } = context;
const members = rootState.im.groupManage.getGroupMembers(state.sid);
context.commit('setMemberList', members);
groupManage.asyncGetGroupListDetail(gids) ⇒ Promise.<Array.<module:types~BriefGroupInfoAndSettings>>
按id获取群组详情
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~BriefGroupInfoAndSettings>>
- 群组详情列表
Param | Type | Description |
---|---|---|
gids | Array.<number> |
群组ID列表 |
Example
promistAllAarr.push(this.im.groupManage.asyncGetGroupListDetail(groupIds));
groupManage.getGruopMessage(gid) ⇒ Array.<Meta>
获取群消息
Kind: static method of groupManage
Returns: Array.<Meta>
- 群消息列表
Param | Type | Description |
---|---|---|
gid | number |
群ID |
Example
localMessages = rootState.im.groupManage.getGruopMessage(state.sid);
groupManage.asyncGetInfo(params) ⇒ Promise.<GroupInfoAndSettings>
获取群组详情
Kind: static method of groupManage
Returns: Promise.<GroupInfoAndSettings>
- 群组详情
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
Example
this.im.groupManage.asyncGetInfo({ group_id: this.getSid }).then((res) => {
this.groupInfo = res;
});
const group_id = this.group_id - 0;
if (group_id <= 0) {
alert('请输入');
return;
}
this.$store.getters.im.groupManage.asyncGetInfo({ group_id }).then((res) => {
this.searchObj = res;
});
groupManage.asyncGetMemberList(param) ⇒ Promise.<Array.<module:types~GroupMember>>
获取群成员列表
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupMember>>
- 群成员列表
Param | Type | Description |
---|---|---|
param | object |
参数 |
params.group_id | number |
群组ID |
Example
this.$store.dispatch('content/actionUpdateMemberList');
this.im.groupManage.asyncGetMemberList(this.getSid, true).then((res) => {
this.members = res;
});
alert('已t人');
this.selIdList = [];
this.requireMember();
this.im.groupManage.asyncGetMemberList(group_id, true).then((res) => {
this.members = res;
});
groupManage.readGroupMessage(group_id, mid)
将群消息设置已读
Kind: static method of groupManage
Param | Type | Description |
---|---|---|
group_id | number |
群组ID |
mid | number |
消息ID |
Example
this.$store.getters.im.groupManage.readGroupMessage(this.getSid);
const im = this.$store.getters.im;
if (im) im.groupManage.readGroupMessage(this.getSid, this.message.id);
this.$store.getters.im.groupManage.readGroupMessage(this.getSid);
const im = this.$store.getters.im;
if (im) im.groupManage.readGroupMessage(this.getSid, this.message.id);
groupManage.recallMessage(uid, mid)
撤回消息
Kind: static method of groupManage
Param | Type | Description |
---|---|---|
uid | number |
群组ID |
mid | number |
消息ID |
Example
const idStr = numToString(this.message.id).toString();
this.im.groupManage.recallMessage(this.getSid, idStr);
const idStr = numToString(this.message.id).toString();
this.im.groupManage.recallMessage(this.getSid, idStr);
groupManage.appendMessageContent(uid, mid, content)
追加消息内容
Kind: static method of groupManage
Param | Type | Description |
---|---|---|
uid | number |
会话ID |
mid | number |
消息ID |
content | string |
消息追加内容 |
Example
groupManage.replaceMessage(uid, mid, content, config, ext)
更新消息内容
Kind: static method of groupManage
Param | Type | Default | Description |
---|---|---|---|
uid | number |
会话ID | |
mid | number |
消息ID | |
content | string |
消息更新内容 | |
config | string | object |
null |
消息更新配置 |
ext | string | object |
null |
消息更新扩展信息 |
Example
groupManage.getUnreadCount(gid) ⇒ number
获取群未读消息数
Kind: static method of groupManage
Returns: number
- 未读消息数
Param | Type | Description |
---|---|---|
gid | number |
群组ID |
Example
let name;
const id = item.id;
const content = item.content;
const timestamp = item.timestamp;
const hasAt = item.hasAt;
// const img = allRosterMap[id] && allRosterMap[id].avatar;
let avatar = ''; //(img && this.client.signatureUrl(img, { expires: 600, process: 'image/resize,w_50' })) || '/image/roster.png';
const unreadCount = item.type == 'roster' ? rootState.im.rosterManage.getUnreadCount(id) : rootState.im.groupManage.getUnreadCount(id);
const unread = unreadCount > 0 ? unreadCount : 0;
totalUnreadCount += unread;
if (item.type === 'roster') {
//roster
const sroster = allRosterMap[id] || {};
name = sroster.nick_name || sroster.username || id;
avatar = sroster.avatar;
} else if (item.type === 'group') {
//group
const sgroup = allGroupMap[id] || {};
name = sgroup.name || id;
avatar = sgroup.avatar;
}
avatar = rootState.im.sysManage.g...
const unreadCount = rootState.im.groupManage.getUnreadCount(i.group_id);
i.avatar = rootState.im.sysManage.getImage({
avatar: i.avatar,
type: 'group'
});
return Object.assign(
{
unreadCount
},
i
);
groupManage.asyncGetAdminList(params) ⇒ Promise.<Array.<module:types~GroupMember>>
获取群管理员列表
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupMember>>
- 群管理员列表
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
Example
this.im.groupManage.asyncGetAdminList({ group_id: this.getSid }).then((res) => {
this.admins = (res || []).map((x) => x.user_id);
});
alert('已经删除管理员');
this.im.groupManage.asyncGetAdminList({ group_id: this.getSid }).then((r) => {
this.admins = (r || []).map((i) => i.user_id);
});
this.selIdList = [];
groupManage.asyncAdminAdd(params) ⇒ Promise.<Array.<module:types~GroupUserRelationResponse>>
群添加管理员
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupUserRelationResponse>>
- 结果列表
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
params.user_list | Array.<number> |
群成员列表 |
Example
groupManage.asyncAdminRemove(params) ⇒ Promise.<Array.<module:types~GroupUserRelationResponse>>
移除管理员
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupUserRelationResponse>>
- 结果列表
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
params.user_list | Array.<number> |
群成员列表 |
Example
this.im.groupManage.asyncAdminRemove({ group_id: this.getSid, user_list }).then(() => {
alert('已经删除管理员');
this.im.groupManage.asyncGetAdminList({ group_id: this.getSid }).then((r) => {
this.admins = (r || []).map((i) => i.user_id);
});
this.selIdList = [];
});
groupManage.asyncGetAnouncementById(params) ⇒ Promise.<GroupAnnouncement>
获取群公告详情
Kind: static method of groupManage
Returns: Promise.<GroupAnnouncement>
- 群公告详情
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
params.announcement_id | Array.<number> |
公告ID |
Example
groupManage.asyncAnouncementDelete(params) ⇒ Promise.<boolean>
删除群公告
Kind: static method of groupManage
Returns: Promise.<boolean>
- 是否成功
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
params.announcement_id | Array.<number> |
公告ID |
Example
const group_id = this.getSid;
this.im.groupManage.asyncAnouncementDelete({ group_id, announcement_id }).then(() => {
alert('群公告删除成功');
this.requirePublicList();
});
groupManage.asyncAnnouncementEdit(params) ⇒ Promise.<GroupAnnouncement>
编辑群公告
Kind: static method of groupManage
Returns: Promise.<GroupAnnouncement>
- 群公告详情
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
params.title | string |
公告标题 |
params.content | string |
公告内容 |
Example
const title = this.public_title;
const content = this.public_content;
if (!title || !content) {
alert('请输入内容');
return;
}
const group_id = this.getSid;
this.im.groupManage.asyncAnnouncementEdit({ title, content, group_id }).then(() => {
alert('公告添加成功');
this.requirePublicList();
});
groupManage.asyncGetAnnouncementList(params) ⇒ Promise.<Array.<module:types~GroupAnnouncement>>
群公告列表
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupAnnouncement>>
- 群公告详情列表
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
Example
const group_id = this.getSid;
this.im.groupManage.asyncGetAnnouncementList({ group_id }).then((res = []) => {
this.publicList = [].concat(res).reverse();
});
groupManage.asyncCreate(params) ⇒ Promise.<GroupInfoAndSettings>
创建群组
Kind: static method of groupManage
Returns: Promise.<GroupInfoAndSettings>
- 群详情
Param | Type | Description |
---|---|---|
params | GroupInfoRequest |
请求参数 |
Example
groupManage.asyncDestroy(params) ⇒ Promise.<boolean>
解散群组
Kind: static method of groupManage
Returns: Promise.<boolean>
- 是否成功
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
Example
//dismiss
this.$store.getters.im.groupManage.asyncDestroy({ group_id: this.getSid }).then(() => {
alert('您已解散了此群。。');
});
//dismiss
this.$store.getters.im.groupManage.asyncDestroy({ group_id: this.getSid }).then(() => {
alert('您已解散了此群。。');
});
groupManage.asyncUpdateAvatar(params) ⇒ Promise.<boolean>
更新群头像
Kind: static method of groupManage
Returns: Promise.<boolean>
- 是否成功
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
params.value | string |
头像地址 |
Example
groupManage.asyncUpdateDescription(params) ⇒ Promise.<boolean>
更新群描述
Kind: static method of groupManage
Returns: Promise.<boolean>
- 是否成功
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
params.value | string |
群组描述 |
Example
groupManage.asyncUpdateExt(params) ⇒ Promise.<boolean>
更新群扩展信息
Kind: static method of groupManage
Returns: Promise.<boolean>
- 是否成功
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
params.value | string |
扩展信息 |
Example
groupManage.asyncUpdateName(params) ⇒ Promise.<boolean>
更新群名称
Kind: static method of groupManage
Returns: Promise.<boolean>
- 是否成功
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
params.value | string |
群名称 |
Example
groupManage.asyncGroupMsgMutemode(params) ⇒ Promise.<boolean>
设置群消息免打扰情况
Kind: static method of groupManage
Returns: Promise.<boolean>
- 是否成功
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
params.msg_mute_mode | number |
群消息屏蔽模式: 0 - 表示不屏蔽, 1 - 表示屏蔽本地消息通知, 2 - 表示屏蔽消息,不接收消息 |
Example
groupManage.asyncGroupBannedList(params) ⇒ Promise.<Array.<module:types~GroupMemberBanned>>
获取群禁言列表
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupMemberBanned>>
- 禁言成员列表
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
Example
const group_id = this.getSid;
this.im.groupManage.asyncGroupBannedList({ group_id }).then((res) => {
this.bans = res;
});
groupManage.asyncGroupBab(params) ⇒ Promise.<Array.<module:types~GroupUserRelationResponse>>
禁言群成员
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupUserRelationResponse>>
- 请求结果列表
Param | Type | Description |
---|---|---|
params | GroupBannedMemberRequest |
请求参数 |
Example
let user_list = this.selIdList;
if (!user_list.length) {
alert('请选择');
return;
}
if (!this.banDuration.length) {
alert('请输入禁言时间');
return;
}
if (!/^-?\d+$/.test(this.banDuration)) {
alert('请输入正确禁言时间');
return;
}
const duration = this.banDuration - 0;
const group_id = this.getSid;
this.im.groupManage.asyncGroupBab({ group_id, duration, user_list }).then(() => {
alert('禁言设置成功');
this.requireBanList();
this.selIdList = [];
});
groupManage.asyncGroupUnban(params) ⇒ Promise.<Array.<module:types~GroupUserRelationResponse>>
解除成员禁言
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupUserRelationResponse>>
- 请求结果列表
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
params.user_list | Array.<number> |
群成员列表 |
Example
let user_list = this.selIdList;
if (!user_list.length) {
alert('请选择');
return;
}
const group_id = this.getSid;
this.im.groupManage.asyncGroupUnban({ group_id, user_list }).then(() => {
alert('解除禁言成功');
this.requireBanList();
this.selIdList = [];
});
groupManage.asyncGetSettings(group_id) ⇒ Promise.<GroupInfoAndSettings>
获取群设置
Kind: static method of groupManage
Returns: Promise.<GroupInfoAndSettings>
- 群设置
Param | Type | Description |
---|---|---|
group_id | number |
群ID |
Example
groupManage.asyncUpdateAllowMemberInvitation(params) ⇒ Promise.<boolean>
设置群成员是否可以邀请
Kind: static method of groupManage
Returns: Promise.<boolean>
- 是否成功
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
params.value | boolean |
群成员邀请设置: false - 不允许邀请, true - 允许邀请(默认) |
Example
groupManage.asyncUpdateAllowMemberModify(params) ⇒ Promise.<boolean>
设置群成员是否可以修改群信息
Kind: static method of groupManage
Returns: Promise.<boolean>
- 是否成功
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
params.value | boolean |
群成员修改群信息设置: false - 群成员不能修改群信息(默认), true - 群成员可以修改群信息 |
Example
groupManage.asyncUpdateEnableReadack(params) ⇒ Promise.<boolean>
设置群是否开启已读模式
Kind: static method of groupManage
Returns: Promise.<boolean>
- 是否成功
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
params.value | boolean |
是否开启群消息已读功能: false - 不开启, true - 开启 |
Example
groupManage.asyncUpdateHistoryVisible(params) ⇒ Promise.<boolean>
设置群历史是否可见
Kind: static method of groupManage
Returns: Promise.<boolean>
- 是否成功
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
params.value | boolean |
设置群历史是否可见: false - 不可见, true - 可见 |
Example
groupManage.asyncUpdateRequireadminapproval(params) ⇒ Promise.<boolean>
设置入群是否需要申请
Kind: static method of groupManage
Returns: Promise.<boolean>
- 是否成功
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
params.apply_approval | boolean |
入群申请审批设置, 0:同意所有申请 1:需要管理员确认 2:拒绝所有申请 |
Example
groupManage.asyncBanAll(params) ⇒ Promise.<GroupBanAllResponse>
全员禁言,只允许管理员发消息
Kind: static method of groupManage
Returns: Promise.<GroupBanAllResponse>
- 结果
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.duration | number |
禁言时长,单位为分钟,int64 |
params.group_id | number |
群id,int64 |
Example
groupManage.asyncUnBanAll(params) ⇒ Promise.<boolean>
取消全员禁言
Kind: static method of groupManage
Returns: Promise.<boolean>
- 是否成功
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群id,int64 |
Example
groupManage.asyncOwnerTransfer(params) ⇒ Promise.<GroupUserRelationResponse>
更换群主
Kind: static method of groupManage
Returns: Promise.<GroupUserRelationResponse>
- 结果
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
params.new_owner | number |
新群主的用户ID |
Example
groupManage.asyncGetUserJoined(params) ⇒ Promise.<Array.<number>>
获取用户的群组列表
Kind: static method of groupManage
Returns: Promise.<Array.<number>>
- 群ID的列表
Param | Type | Description |
---|---|---|
params | object |
参数, 空对象 |
Example
groupManage.asyncApply(params) ⇒ Promise.<GroupUserRelationResponse>
申请加入群
Kind: static method of groupManage
Returns: Promise.<GroupUserRelationResponse>
- 结果
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
params.reason | string |
申请入群原因 |
Example
const group_id = this.group_id - 0;
this.$store.getters.im.groupManage.asyncApply({ group_id, reason: '申请加入群' }).then(() => {
alert('请求已发送成功!');
});
const group_id = this.group_id - 0;
this.$store.getters.im.groupManage.asyncApply({ group_id, reason: '申请加入群' }).then(() => {
alert('请求已发送成功!');
});
groupManage.asyncApplyHandle(params) ⇒ Promise.<GroupUserRelationResponse>
处理用户的入群申请
Kind: static method of groupManage
Returns: Promise.<GroupUserRelationResponse>
- 结果
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
params.user_id | number |
用户ID |
params.approval | boolean |
审批结果:true为同意,false为拒绝 |
Example
const { approval } = p;
this.im.groupManage.asyncApplyHandle(p).then(() => {
alert('您已' + (approval ? '同意' : '拒绝') + '该申请');
this.requireNotice();
});
groupManage.asyncGroupBockedlist(params) ⇒ Promise.<Array.<module:types~GroupBlockedListItem>>
获取群黑名单
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupBlockedListItem>>
- 群黑名单列表
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
Example
const group_id = this.getSid;
this.im.groupManage.asyncGroupBockedlist({ group_id }).then((res) => {
this.blocks = res;
});
groupManage.asyncGroupBlock(params) ⇒ Promise.<Array.<module:types~GroupUserRelationResponse>>
将成员加入黑名单
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupUserRelationResponse>>
- 结果列表
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
params.user_list | Array.<number> |
群成员列表 |
Example
let user_list = this.selIdList;
if (!user_list.length) {
alert('请选择');
return;
}
const group_id = this.getSid;
this.im.groupManage.asyncGroupBlock({ group_id, user_list }).then(() => {
alert('已加黑');
this.selIdList = [];
this.requireMember();
});
groupManage.asyncGroupUnblock(params) ⇒ Promise.<Array.<module:types~GroupUserRelationResponse>>
解除黑名单
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupUserRelationResponse>>
- 结果列表
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
params.user_list | Array.<number> |
群成员列表 |
Example
let user_list = this.selIdList;
if (!user_list.length) {
alert('请选择');
return;
}
const group_id = this.getSid;
this.im.groupManage.asyncGroupUnblock({ group_id, user_list }).then(() => {
alert('解除黑名单成功');
this.requireBlockList();
});
groupManage.asyncKick(params) ⇒ Promise.<Array.<module:types~GroupUserRelationResponse>>
踢出群组
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupUserRelationResponse>>
- 结果列表
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
params.user_list | Array.<number> |
群成员列表 |
Example
let user_list = this.selIdList;
const group_id = this.getSid;
if (!user_list.length) {
alert('您没有选择群成员');
return;
}
this.im.groupManage.asyncKick({ group_id, user_list }).then(() => {
alert('已t人');
this.selIdList = [];
this.requireMember();
this.im.groupManage.asyncGetMemberList(group_id, true).then((res) => {
this.members = res;
});
});
groupManage.asyncGetInvitationList() ⇒ Promise.<Array.<module:types~GroupInvitation>>
获取群邀请列表
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupInvitation>>
- 群邀请列表
Example
this.im.groupManage.asyncGetInvitationList({}).then((res) => {
this.prepareNotice(res);
});
groupManage.asyncInvite(params) ⇒ Promise.<Array.<module:types~GroupUserRelationResponse>>
邀请成员加入群
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupUserRelationResponse>>
- 结果列表
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
params.user_list | Array.<number> |
群成员列表 |
Example
let user_list = this.selIdList;
const group_id = this.getSid;
this.im.groupManage.asyncInvite({ group_id, user_list }).then(() => {
alert('邀请成功');
this.selIdList = [];
this.requireMember();
});
groupManage.asyncInviteHandle(params) ⇒ Promise.<boolean>
处理群邀请
Kind: static method of groupManage
Returns: Promise.<boolean>
- 是否成功
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
params.user_id | number |
用户ID |
params.approval | boolean |
审批结果:true为同意,false为拒绝 |
Example
const { approval } = p;
this.im.groupManage.asyncInviteHandle(p).then(() => {
alert('您已' + (approval ? '同意' : '拒绝') + '加入该群');
this.requireNotice();
});
groupManage.asyncGetMemberDisplayName(params) ⇒ Promise.<Array.<module:types~GroupMember>>
批量获取群成员的群名片
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupMember>>
- 群成员列表
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
params.user_list | Array.<number> |
群成员列表 |
Example
groupManage.asyncLeave(params) ⇒ Promise.<boolean>
退出群
Kind: static method of groupManage
Returns: Promise.<boolean>
- 是否成功
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
Example
//leave
this.$store.getters.im.groupManage.asyncLeave({ group_id: this.getSid }).then(() => {
alert('您已退出了此群。。');
});
//leave
this.$store.getters.im.groupManage.asyncLeave({ group_id: this.getSid }).then(() => {
alert('您已退出了此群。。');
});
groupManage.asyncUpdateDisplayName(params) ⇒ Promise.<boolean>
修改群名片
Kind: static method of groupManage
Returns: Promise.<boolean>
- 是否成功
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
params.value | string |
新名片 |
Example
groupManage.asncGetApplicationList(params) ⇒ Promise.<Array.<module:types~GroupApplication>>
获取群申请列表
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupApplication>>
- 群申请列表
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_list | Array.<number> |
群列表 |
Example
const group_list = res.map((item) => item.group_id || item);
this.im.groupManage.asncGetApplicationList({ group_list }).then((rs) => {
this.prepareNotice(rs);
});
groupManage.asyncGetFileList(params) ⇒ Promise.<Array.<module:types~GroupSharedFile>>
获取群文件列表
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupSharedFile>>
- 群文件列表
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
Example
const group_id = this.getSid;
this.im.groupManage.asyncGetFileList({ group_id }).then((res = []) => {
this.fileList = [].concat(res);
});
groupManage.asyncFileDelete(params) ⇒ Promise.<Array.<module:types~GroupSharedFileResponse>>
删除群文件
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupSharedFileResponse>>
- 结果列表
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群组ID |
params.file_list | Array.<number> |
文件ID列表 |
Example
this.im.groupManage.asyncFileDelete({ file_list, group_id }).then(() => {
this.requireFileList();
});
groupManage.asyncFileUpload(params) ⇒ Promise.<Array.<module:types~GroupSharedFile>>
上传群文件
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupSharedFile>>
- 群文件列表
Param | Type | Description |
---|---|---|
params | object |
参数 |
params.group_id | number |
群id,int64 |
params.name | string |
文件名称 |
params.size | number |
文件大小,int64 |
params.type | string |
文件类型 |
params.url | string |
文件url |
Example