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.alias || 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.get...
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.alias || 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.alias || 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 im = this.im;
if (!im || !Array.isArray(items) || !items.length) {
return Promise.resolve();
}
const rosterMap = im.rosterManage.getAllRosterDetail() || {};
const groupMap = im.groupManage.getAllGroupDetail() || {};
const rosterIds = [];
const groupIds = [];
items.forEach((item) => {
const payload = item.payload || {};
const fromUid = payload.from && typeof payload.from.uid !== 'undefined' ? Number(payload.from.uid) : 0;
const to = Array.isArray(payload.to) ? payload.to : [];
const gid = payload.gid && typeof payload.gid.uid !== 'undefined' ? Number(payload.gid.uid) : 0;
if (fromUid > 0 && !(rosterMap[fromUid] && rosterMap[fromUid].username)) {
rosterIds.push(fromUid);
}
to.forEach((entry) => {
const uid = entry && typeof entry.uid !== 'undefined' ? Number(entry.uid) : 0;
if (uid > 0 && !(rosterMap[uid] && rosterMap[uid].username)) ...if (!gid) return this.$t('群组通知');
const groupMap = (this.im && this.im.groupManage.getAllGroupDetail()) || {};
const group = groupMap[gid] || {};
return group.name || this.$t('群 {id}', { id: gid });
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));requests.push(im.groupManage.asyncGetGroupListDetail(uniqueGroupIds));
groupManage.getGruopMessage(gid) ⇒ Array.<Meta>
获取群消息
Kind: static method of groupManage
Returns: Array.<Meta> - 群消息列表
| Param | Type | Description |
|---|---|---|
| gid | number |
群ID |
Example
const fallbackMessages = item.type === 'roster' ? rootState.im.rosterManage.getRosterMessageByRid(id) : rootState.im.groupManage.getGruopMessage(id);
fallbackPreview = deriveRecentPreviewFromMessage(fallbackMessages && fallbackMessages.length ? fallbackMessages[fallbackMessages.length - 1] : null);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(this.$t('请输入'));
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(this.$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);this.$store.getters.im.groupManage.readGroupMessage(this.getSid);
groupManage.recallMessage(uid, mid)
撤回消息
Kind: static method of groupManage
| Param | Type | Description |
|---|---|---|
| uid | number |
群组ID |
| mid | number |
消息ID |
Example
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 draft = typeof item.draft === 'string' ? item.draft : '';
const hasDraft = !!draft.trim();
const needsFallbackContent = !hasDraft && !item.content;
const needsFallbackTimestamp = (!hasDraft && !item.timestamp) || (hasDraft && !item.draftTimestamp && !item.timestamp);
let fallbackPreview = {
content: '',
timestamp: ''
};
if (needsFallbackContent || needsFallbackTimestamp) {
const fallbackMessages = item.type === 'roster' ? rootState.im.rosterManage.getRosterMessageByRid(id) : rootState.im.groupManage.getGruopMessage(id);
fallbackPreview = deriveRecentPreviewFromMessage(fallbackMessages && fallbackMessages.length ? fallbackMessages[fallbackMessages.length - 1] : null);
}
const content = hasDraft ? draft : item.content || fallbackPreview.content;
const timestamp = hasDraft ? item.draftTimestamp || item.timestamp || fallbackPreview.timestamp : ite...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.$t('已经删除管理员'));
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.$t('已经删除管理员'));
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.$t('群公告删除成功'));
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(this.$t('请输入内容'));
return;
}
const group_id = this.getSid;
this.im.groupManage.asyncAnnouncementEdit({ title, content, group_id }).then(() => {
alert(this.$t('公告添加成功'));
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
this.$store.getters.im.groupManage.asyncDestroy({ group_id: this.getSid }).then(() => {
this.$message.success(this.$t('群组已解散'));
});this.$store.getters.im.groupManage.asyncDestroy({ group_id: this.getSid }).then(() => {
this.$message.success(this.$t('群组已解散'));
});
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(this.$t('请选择'));
return;
}
if (!this.banDuration.length) {
alert(this.$t('请输入禁言时间'));
return;
}
if (!/^-?\d+$/.test(this.banDuration)) {
alert(this.$t('请输入正确禁言时间'));
return;
}
const duration = this.banDuration - 0;
const group_id = this.getSid;
this.im.groupManage.asyncGroupBab({ group_id, duration, user_list }).then(() => {
alert(this.$t('禁言设置成功'));
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(this.$t('请选择'));
return;
}
const group_id = this.getSid;
this.im.groupManage.asyncGroupUnban({ group_id, user_list }).then(() => {
alert(this.$t('解除禁言成功'));
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: this.$t('申请加入群') }).then(() => {
alert(this.$t('请求已发送成功!'));
this.clickJoinGroupCloseHandler();
});const group_id = this.group_id - 0;
this.$store.getters.im.groupManage.asyncApply({ group_id, reason: this.$t('申请加入群') }).then(() => {
alert(this.$t('请求已发送成功!'));
});
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.$t('您已同意该申请') : this.$t('您已拒绝该申请'));
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(this.$t('请选择'));
return;
}
const group_id = this.getSid;
this.im.groupManage.asyncGroupBlock({ group_id, user_list }).then(() => {
alert(this.$t('已加黑'));
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(this.$t('请选择'));
return;
}
const group_id = this.getSid;
this.im.groupManage.asyncGroupUnblock({ group_id, user_list }).then(() => {
alert(this.$t('解除黑名单成功'));
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(this.$t('您没有选择群成员'));
return;
}
this.im.groupManage.asyncKick({ group_id, user_list }).then(() => {
alert(this.$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.$t('邀请成功'));
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.$t('您已同意加入该群') : this.$t('您已拒绝加入该群'));
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
this.$store.getters.im.groupManage.asyncLeave({ group_id: this.getSid }).then(() => {
this.$message.success(this.$t('group.quitSuccess', { origin: '您已退出群组' }));
});this.$store.getters.im.groupManage.asyncLeave({ group_id: this.getSid }).then(() => {
this.$message.success(this.$t('group.quitSuccess', { origin: '您已退出群组' }));
});
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
