groupManage
groupManage
Group management
- 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)
- .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>
Get group information
Kind: static method of groupManage
Returns: Promise.<GroupInfoAndSettings> - Group info
| Param | Type | Description |
|---|---|---|
| group_id | number |
GroupID |
| froce | boolean |
Whether to force pull from server: true - pull from server, false - prefer to pull from local storage |
Example
const { rootState, state } = context;
rootState.im.groupManage.asyncGetGroupInfo(state.sid).then((res) => {
context.commit('setGroupInfo', res);
});
groupManage.asyncGetJoinedGroups(froce) ⇒ Promise.<Array.<number>>
Get the group to join
Kind: static method of groupManage
Returns: Promise.<Array.<number>> - Group ID list
| Param | Type | Description |
|---|---|---|
| froce | boolean |
Whether to force pull from server: true - pull from server, false - prefer to pull from local storage |
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)
Open group, this method will prepare some necessary information for the group chat screen.
Kind: static method of groupManage
| Param | Type | Description |
|---|---|---|
| group_id | number |
GroupID |
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>
Get all cached group details
Kind: static method of groupManage
Returns: Object.<number, module:types~GroupInfoAndSettings> - Group details
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>>
Get group member ids (asynchronous)
Kind: static method of groupManage
Returns: Promise.<Array.<number>> - List of group member ids
| Param | Type | Description |
|---|---|---|
| group_id | number |
GroupID |
Example
groupManage.getGroupMembers(group_id) ⇒ Array.<GroupMember>
Get group members (synchronous)
Kind: static method of groupManage
Returns: Array.<GroupMember> - List of group members
| Param | Type | Description |
|---|---|---|
| group_id | number |
GroupID |
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>>
Get group details by id
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~BriefGroupInfoAndSettings>> - List of group details
| Param | Type | Description |
|---|---|---|
| gids | Array.<number> |
Group ID list |
Example
promistAllAarr.push(this.im.groupManage.asyncGetGroupListDetail(groupIds));requests.push(im.groupManage.asyncGetGroupListDetail(uniqueGroupIds));
groupManage.getGruopMessage(gid) ⇒ Array.<Meta>
Get group information
Kind: static method of groupManage
Returns: Array.<Meta> - List of group messages
| Param | Type | Description |
|---|---|---|
| gid | number |
GroupID |
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>
Get group details
Kind: static method of groupManage
Returns: Promise.<GroupInfoAndSettings> - Group details
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
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>>
Get group member list
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupMember>> - List of group members
| Param | Type | Description |
|---|---|---|
| param | object |
Parameter |
| params.group_id | number |
GroupID |
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)
Set group message to read
Kind: static method of groupManage
| Param | Type | Description |
|---|---|---|
| group_id | number |
GroupID |
| mid | number |
MessageID |
Example
this.$store.getters.im.groupManage.readGroupMessage(this.getSid);this.$store.getters.im.groupManage.readGroupMessage(this.getSid);
groupManage.recallMessage(uid, mid)
Revoke message
Kind: static method of groupManage
| Param | Type | Description |
|---|---|---|
| uid | number |
GroupID |
| mid | number |
MessageID |
Example
groupManage.getUnreadCount(gid) ⇒ number
Get number of unread group messages
Kind: static method of groupManage
Returns: number - Unread message-number
| Param | Type | Description |
|---|---|---|
| gid | number |
GroupID |
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>>
Get the list of group Admins
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupMember>> - List of group admins
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
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>>
Add group Admin
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupUserRelationResponse>> - List of results
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
| params.user_list | Array.<number> |
List of group members |
Example
groupManage.asyncAdminRemove(params) ⇒ Promise.<Array.<module:types~GroupUserRelationResponse>>
Remove group Admin
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupUserRelationResponse>> - List of results
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
| params.user_list | Array.<number> |
List of group members |
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>
Get group announcement details
Kind: static method of groupManage
Returns: Promise.<GroupAnnouncement> - Group announcement details
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
| params.announcement_id | Array.<number> |
Announcement ID |
Example
groupManage.asyncAnouncementDelete(params) ⇒ Promise.<boolean>
Delete group announcement
Kind: static method of groupManage
Returns: Promise.<boolean> - Success or not
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
| params.announcement_id | Array.<number> |
Announcement 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>
Edit group announcement
Kind: static method of groupManage
Returns: Promise.<GroupAnnouncement> - Group announcement details
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
| params.title | string |
Announcement tittle |
| params.content | string |
Announcement content |
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>>
Group announcement list
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupAnnouncement>> - List of group announcement details
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
Example
const group_id = this.getSid;
this.im.groupManage.asyncGetAnnouncementList({ group_id }).then((res = []) => {
this.publicList = [].concat(res).reverse();
});
groupManage.asyncCreate(params) ⇒ Promise.<GroupInfoAndSettings>
Create group
Kind: static method of groupManage
Returns: Promise.<GroupInfoAndSettings> - Group details
| Param | Type | Description |
|---|---|---|
| params | GroupInfoRequest |
Request parameters |
Example
groupManage.asyncDestroy(params) ⇒ Promise.<boolean>
Dissolve group
Kind: static method of groupManage
Returns: Promise.<boolean> - Success or not
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
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>
Update group avatar
Kind: static method of groupManage
Returns: Promise.<boolean> - Success or not
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
| params.value | string |
AvatarAddress |
Example
groupManage.asyncUpdateDescription(params) ⇒ Promise.<boolean>
Update group description
Kind: static method of groupManage
Returns: Promise.<boolean> - Success or not
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
| params.value | string |
Group description |
Example
groupManage.asyncUpdateExt(params) ⇒ Promise.<boolean>
Update group extension information
Kind: static method of groupManage
Returns: Promise.<boolean> - Success or not
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
| params.value | string |
Extension information |
Example
groupManage.asyncUpdateName(params) ⇒ Promise.<boolean>
Update group name
Kind: static method of groupManage
Returns: Promise.<boolean> - Success or not
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
| params.value | string |
Group name |
Example
groupManage.asyncGroupMsgMutemode(params) ⇒ Promise.<boolean>
Set do-not-disturb conditions for group message
Kind: static method of groupManage
Returns: Promise.<boolean> - Success or not
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
| params.msg_mute_mode | number |
Group message blocking mode: 0 - no blocking, 1 - blocking local message notifications, 2 - blocking all, means not receiving messages |
Example
groupManage.asyncGroupBannedList(params) ⇒ Promise.<Array.<module:types~GroupMemberBanned>>
Get group ban list
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupMemberBanned>> - List of banned members
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
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>>
Ban group member
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupUserRelationResponse>> - List of request results
| Param | Type | Description |
|---|---|---|
| params | GroupBannedMemberRequest |
Request parameters |
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>>
Unban group memberBan
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupUserRelationResponse>> - List of request results
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
| params.user_list | Array.<number> |
List of group members |
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>
Get group settings
Kind: static method of groupManage
Returns: Promise.<GroupInfoAndSettings> - Group settings
| Param | Type | Description |
|---|---|---|
| group_id | number |
GroupID |
Example
groupManage.asyncUpdateAllowMemberInvitation(params) ⇒ Promise.<boolean>
Set whether group members can invite new member
Kind: static method of groupManage
Returns: Promise.<boolean> - Success or not
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
| params.value | boolean |
Group member invite settings: false - do not allow invitations, true - allow invitations (default) |
Example
groupManage.asyncUpdateAllowMemberModify(params) ⇒ Promise.<boolean>
Set whether group members can modify group information
Kind: static method of groupManage
Returns: Promise.<boolean> - Success or not
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
| params.value | boolean |
Group members modify group info settings: false - group members can't modify group info (default), true - group members can modify group info |
Example
groupManage.asyncUpdateEnableReadack(params) ⇒ Promise.<boolean>
Set whether to enable read mode in group
Kind: static method of groupManage
Returns: Promise.<boolean> - Success or not
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
| params.value | boolean |
Enable or disable group message read feature: false - disabled, true - enabled |
Example
groupManage.asyncUpdateHistoryVisible(params) ⇒ Promise.<boolean>
Set whether group history is visible
Kind: static method of groupManage
Returns: Promise.<boolean> - Success or not
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
| params.value | boolean |
Set whether the group history is visible: false - not visible, true - visible |
Example
groupManage.asyncUpdateRequireadminapproval(params) ⇒ Promise.<boolean>
Set whether need to apply for group joining
Kind: static method of groupManage
Returns: Promise.<boolean> - Success or not
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
| params.apply_approval | boolean |
Group membership application settings, 0: Agree all requests 1: Need to confirm by Admin 2: Reject all requests |
Example
groupManage.asyncBanAll(params) ⇒ Promise.<GroupBanAllResponse>
Ban all members, only Admins can send messages
Kind: static method of groupManage
Returns: Promise.<GroupBanAllResponse> - Results
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.duration | number |
Duration of banned in minutes,int64 |
| params.group_id | number |
Group id,int64 |
Example
groupManage.asyncUnBanAll(params) ⇒ Promise.<boolean>
Unban all members
Kind: static method of groupManage
Returns: Promise.<boolean> - Success or not
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
Group id,int64 |
Example
groupManage.asyncOwnerTransfer(params) ⇒ Promise.<GroupUserRelationResponse>
Change group Owner
Kind: static method of groupManage
Returns: Promise.<GroupUserRelationResponse> - Results
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
| params.new_owner | number |
User ID of the new group owner |
Example
groupManage.asyncGetUserJoined(params) ⇒ Promise.<Array.<number>>
Get the list of groups for the user
Kind: static method of groupManage
Returns: Promise.<Array.<number>> - List of group IDs
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter, Empty object |
Example
groupManage.asyncApply(params) ⇒ Promise.<GroupUserRelationResponse>
Apply to join group
Kind: static method of groupManage
Returns: Promise.<GroupUserRelationResponse> - Results
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
| params.reason | string |
Reason for membership application |
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>
Process user's group joining application
Kind: static method of groupManage
Returns: Promise.<GroupUserRelationResponse> - Results
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
| params.user_id | number |
User ID |
| params.approval | boolean |
Approval result: true for agree, false for reject |
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>>
Get group blacklist
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupBlockedListItem>> - GroupList of blacklists
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
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>>
Add member to blacklist
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupUserRelationResponse>> - List of results
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
| params.user_list | Array.<number> |
List of group members |
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>>
Remove member from blacklist
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupUserRelationResponse>> - List of results
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
| params.user_list | Array.<number> |
List of group members |
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>>
Kick out group member
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupUserRelationResponse>> - List of results
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
| params.user_list | Array.<number> |
List of group members |
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>>
Get group invitation list
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupInvitation>> - List of group invitations
Example
this.im.groupManage.asyncGetInvitationList({}).then((res) => {
this.prepareNotice(res);
});
groupManage.asyncInvite(params) ⇒ Promise.<Array.<module:types~GroupUserRelationResponse>>
Invite member to group
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupUserRelationResponse>> - List of results
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
| params.user_list | Array.<number> |
List of group members |
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>
Process group invitations
Kind: static method of groupManage
Returns: Promise.<boolean> - Success or not
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
| params.user_id | number |
User ID |
| params.approval | boolean |
Approval result: true for agree, false for reject |
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>>
Batch retrieval of group member profiles
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupMember>> - List of group members
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
| params.user_list | Array.<number> |
List of group members |
Example
groupManage.asyncLeave(params) ⇒ Promise.<boolean>
Quit group
Kind: static method of groupManage
Returns: Promise.<boolean> - Success or not
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
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>
Modify group profile
Kind: static method of groupManage
Returns: Promise.<boolean> - Success or not
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
| params.value | string |
New user profile |
Example
groupManage.asncGetApplicationList(params) ⇒ Promise.<Array.<module:types~GroupApplication>>
Get the list of group membership requests
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupApplication>> - List of group applications
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_list | Array.<number> |
List of groups |
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>>
Get the list of group files
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupSharedFile>> - List of group files
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
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>>
Delete group file
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupSharedFileResponse>> - List of results
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
GroupID |
| params.file_list | Array.<number> |
List of file IDs |
Example
this.im.groupManage.asyncFileDelete({ file_list, group_id }).then(() => {
this.requireFileList();
});
groupManage.asyncFileUpload(params) ⇒ Promise.<Array.<module:types~GroupSharedFile>>
Upload group file
Kind: static method of groupManage
Returns: Promise.<Array.<module:types~GroupSharedFile>> - List of group files
| Param | Type | Description |
|---|---|---|
| params | object |
Parameter |
| params.group_id | number |
Group id,int64 |
| params.name | string |
File name |
| params.size | number |
File size,int64 |
| params.type | string |
File type |
| params.url | string |
File url |
Example
