add GetGroupAbstractInfo api

pull/261/head
skiffer-git 2 years ago
parent cda0fb6a10
commit 5db5bf17cb

@ -243,50 +243,6 @@ func GetGroupAllMemberList(c *gin.Context) {
c.JSON(http.StatusOK, memberListResp)
}
//get_group_all_member_list_by_split
func GetGroupAllMemberListBySplit(c *gin.Context) {
params := api.GetGroupAllMemberListBySplitReq{}
if err := c.BindJSON(&params); err != nil {
log.NewError("0", "BindJSON failed ", err.Error())
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
return
}
req := &rpc.GetGroupAllMemberReq{}
utils.CopyStructFields(req, &params)
var ok bool
var errInfo string
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
if !ok {
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
log.NewInfo(req.OperationID, "GetGroupAllMember args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewGroupClient(etcdConn)
RpcResp, err := client.GetGroupAllMember(context.Background(), req)
if err != nil {
log.NewError(req.OperationID, "GetGroupAllMember failed err", err.Error(), req.String())
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
return
}
memberListResp := api.GetGroupAllMemberResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, MemberList: RpcResp.MemberList}
memberListResp.Data = jsonData.JsonDataList(memberListResp.MemberList)
log.NewInfo(req.OperationID, "GetGroupAllMember api return ", memberListResp)
c.JSON(http.StatusOK, memberListResp)
}
// @Summary 获取用户加入群列表
// @Description 获取用户加入群列表
// @Tags 群组相关

@ -73,25 +73,28 @@ type GetGroupMemberListResp struct {
type GetGroupAllMemberReq struct {
GroupID string `json:"groupID" binding:"required"`
OperationID string `json:"operationID" binding:"required"`
}
type GetGroupAllMemberResp struct {
CommResp
MemberList []*open_im_sdk.GroupMemberFullInfo `json:"-"`
Data []map[string]interface{} `json:"data" swaggerignore:"true"`
}
type GetGroupAllMemberListBySplitReq struct {
GroupID string `json:"groupID" binding:"required"`
OperationID string `json:"operationID" binding:"required"`
Offset int32 `json:"offset" binding:"required"`
Count int32 `json:"count" binding:"required"`
}
type GetGroupAllMemberListBySplitResp struct {
type GetGroupAllMemberResp struct {
CommResp
MemberList []*open_im_sdk.GroupMemberFullInfo `json:"-"`
Data []map[string]interface{} `json:"data" swaggerignore:"true"`
}
//
//type GetGroupAllMemberListBySplitReq struct {
// GroupID string `json:"groupID" binding:"required"`
// OperationID string `json:"operationID" binding:"required"`
// Offset int32 `json:"offset" binding:"required"`
// Count int32 `json:"count" binding:"required"`
//}
//type GetGroupAllMemberListBySplitResp struct {
// CommResp
// MemberList []*open_im_sdk.GroupMemberFullInfo `json:"-"`
// Data []map[string]interface{} `json:"data" swaggerignore:"true"`
//}
type CreateGroupReq struct {
MemberList []*GroupAddMemberInfo `json:"memberList"`
OwnerUserID string `json:"ownerUserID"`

File diff suppressed because it is too large Load Diff

@ -433,6 +433,19 @@ message SetGroupMemberInfoResp{
CommonResp CommonResp = 1;
}
message GetGroupAbstractInfoReq{
string groupID = 1;
string opUserID = 2;
string operationID = 3;
}
message GetGroupAbstractInfoResp{
CommonResp CommonResp = 1;
int32 groupMemberNumber = 2;
uint64 groupMemberListHash = 3;
}
service group{
rpc createGroup(CreateGroupReq) returns(CreateGroupResp);
rpc joinGroup(JoinGroupReq) returns(JoinGroupResp);
@ -471,7 +484,7 @@ service group{
rpc GetJoinedSuperGroupList(GetJoinedSuperGroupListReq) returns (GetJoinedSuperGroupListResp);
rpc GetSuperGroupsInfo(GetSuperGroupsInfoReq) returns (GetSuperGroupsInfoResp);
rpc SetGroupMemberInfo(SetGroupMemberInfoReq) returns (SetGroupMemberInfoResp);
rpc GetGroupAbstractInfo(GetGroupAbstractInfoReq) returns (GetGroupAbstractInfoResp);
}

Loading…
Cancel
Save