mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-05-28 08:19:18 +08:00
get the group all member
This commit is contained in:
parent
2cb48f3c32
commit
c3492a3a44
@ -135,6 +135,10 @@ type GetGroupMemberListReq struct {
|
|||||||
NextSeq int32 `json:"nextSeq"`
|
NextSeq int32 `json:"nextSeq"`
|
||||||
OperationID string `json:"operationID"`
|
OperationID string `json:"operationID"`
|
||||||
}
|
}
|
||||||
|
type getGroupAllMemberReq struct {
|
||||||
|
GroupID string `json:"groupID"`
|
||||||
|
OperationID string `json:"operationID"`
|
||||||
|
}
|
||||||
|
|
||||||
type MemberResult struct {
|
type MemberResult struct {
|
||||||
GroupId string `json:"groupID"`
|
GroupId string `json:"groupID"`
|
||||||
@ -196,6 +200,52 @@ func GetGroupMemberList(c *gin.Context) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetGroupAllMember(c *gin.Context) {
|
||||||
|
log.Info("", "", "GetGroupAllMember start....")
|
||||||
|
|
||||||
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||||
|
client := pb.NewGroupClient(etcdConn)
|
||||||
|
defer etcdConn.Close()
|
||||||
|
|
||||||
|
params := getGroupAllMemberReq{}
|
||||||
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
req := &pb.GetGroupAllMemberReq{
|
||||||
|
GroupID: params.GroupID,
|
||||||
|
OperationID: params.OperationID,
|
||||||
|
Token: c.Request.Header.Get("token"),
|
||||||
|
}
|
||||||
|
log.Info(req.Token, req.OperationID, "recv req: ", req.String())
|
||||||
|
RpcResp, err := client.GetGroupAllMember(context.Background(), req)
|
||||||
|
if err != nil {
|
||||||
|
log.Error(req.Token, req.OperationID, "GetGroupAllMember failed, err: ", err.Error())
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetGroupMemberListResp struct {
|
||||||
|
ErrorCode int32 `json:"errCode"`
|
||||||
|
ErrorMsg string `json:"errMsg"`
|
||||||
|
Data []MemberResult `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
var memberListResp GetGroupMemberListResp
|
||||||
|
memberListResp.ErrorMsg = RpcResp.ErrorMsg
|
||||||
|
memberListResp.ErrorCode = RpcResp.ErrorCode
|
||||||
|
for _, v := range RpcResp.MemberList {
|
||||||
|
memberListResp.Data = append(memberListResp.Data,
|
||||||
|
MemberResult{GroupId: req.GroupID,
|
||||||
|
UserId: v.UserId,
|
||||||
|
Role: v.Role,
|
||||||
|
JoinTime: uint64(v.JoinTime),
|
||||||
|
Nickname: v.NickName,
|
||||||
|
FaceUrl: v.FaceUrl})
|
||||||
|
}
|
||||||
|
c.JSON(http.StatusOK, memberListResp)
|
||||||
|
}
|
||||||
|
|
||||||
type groupResult struct {
|
type groupResult struct {
|
||||||
GroupId string `json:"groupId"`
|
GroupId string `json:"groupId"`
|
||||||
GroupName string `json:"groupName"`
|
GroupName string `json:"groupName"`
|
||||||
|
@ -63,6 +63,7 @@ func main() {
|
|||||||
groupRouterGroup.POST("/get_groups_info", group.GetGroupsInfo)
|
groupRouterGroup.POST("/get_groups_info", group.GetGroupsInfo)
|
||||||
groupRouterGroup.POST("/kick_group", group.KickGroupMember)
|
groupRouterGroup.POST("/kick_group", group.KickGroupMember)
|
||||||
groupRouterGroup.POST("/get_group_member_list", group.GetGroupMemberList)
|
groupRouterGroup.POST("/get_group_member_list", group.GetGroupMemberList)
|
||||||
|
groupRouterGroup.POST("/get_group_all_member_list", group.GetGroupAllMember)
|
||||||
groupRouterGroup.POST("/get_group_members_info", group.GetGroupMembersInfo)
|
groupRouterGroup.POST("/get_group_members_info", group.GetGroupMembersInfo)
|
||||||
groupRouterGroup.POST("/invite_user_to_group", group.InviteUserToGroup)
|
groupRouterGroup.POST("/invite_user_to_group", group.InviteUserToGroup)
|
||||||
groupRouterGroup.POST("/get_joined_group_list", group.GetJoinedGroupList)
|
groupRouterGroup.POST("/get_joined_group_list", group.GetJoinedGroupList)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user