groupManage

groupManage

Group management

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.username,
        id: rosterInfo.user_id
      };
    });
    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
    };
  });
  // this.forwardMembers.groupps = [].concat(retObj);
  context.commit('setGroupList', [].concat(retObj));
});

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.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.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 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] || {};
   ...

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

alert('已t人');
this.selIdList = [];
this.im.groupManage.asyncGetGroupMembers(group_id, true).then((res) => {
  this.members = res;
});

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));

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

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('请输入');
  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.im.groupManage.asyncGetMemberList(this.getSid, 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);
const im = this.$store.getters.im;
if (im) im.groupManage.readGroupMessage(this.getSid, this.message.id);
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.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 content = item.content;
 const timestamp = item.timestamp;
 // 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.alias || 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.getImage({
...
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.im.groupManage.asyncGetAdminList({ group_id: this.getSid }).then((r) => {
  this.adminList = (r || []).map((i) => i.user_id);
});

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.im.groupManage.asyncGetAdminList({ group_id: this.getSid }).then((r) => {
    this.adminList = (r || []).map((i) => i.user_id);
  });
});

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.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('请输入内容');
  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>>

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);
});

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

//dismiss
this.$store.getters.im.groupManage.asyncDestroy({ group_id: this.getSid }).then(() => {
  alert('您已解散了此群。。');
});

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('请选择');
  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();
});

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('请选择');
  return;
}
const group_id = this.getSid;

this.im.groupManage.asyncGroupUnban({ group_id, user_list }).then(() => {
  alert('解除禁言成功');
  this.requireBanList();
});

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: '申请加入群' }).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>

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.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('请选择');
  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>>

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('请选择');
  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>>

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;
this.im.groupManage.asyncKick({ group_id, user_list }).then(() => {
  alert('已t人');
  this.selIdList = [];
  this.im.groupManage.asyncGetGroupMembers(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.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.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

//leave
this.$store.getters.im.groupManage.asyncLeave({ group_id: this.getSid }).then(() => {
  alert('您已退出了此群。。');
});

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

let file_list = this.selIdList;
const group_id = this.getSid;
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

© 2019-2023 MaximTop | Homepage Last modified time: 2023-08-09 14:48:15

results matching ""

    No results matching ""