diff --git a/internal/api/group/group.go b/internal/api/group/group.go index fbb75dc18..76e87c983 100644 --- a/internal/api/group/group.go +++ b/internal/api/group/group.go @@ -372,12 +372,25 @@ func GetGroupsInfo(c *gin.Context) { return } - resp := api.GetGroupInfoResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, GroupInfoList: RpcResp.GroupInfoList} + resp := api.GetGroupInfoResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, GroupInfoList: transferGroupInfo(RpcResp.GroupInfoList)} resp.Data = jsonData.JsonDataList(resp.GroupInfoList) log.NewInfo(req.OperationID, "GetGroupsInfo api return ", resp) c.JSON(http.StatusOK, resp) } +func transferGroupInfo(input []*open_im_sdk.GroupInfo) []*api.GroupInfoAlias { + var result []*api.GroupInfoAlias + for _, v := range input { + t := &api.GroupInfoAlias{} + utils.CopyStructFields(t, &v) + if v.NeedVerification != nil { + t.NeedVerification = v.NeedVerification.Value + } + result = append(result, t) + } + return result +} + //process application func ApplicationGroupResponse(c *gin.Context) { params := api.ApplicationGroupResponseReq{} diff --git a/pkg/base_info/group_api_struct.go b/pkg/base_info/group_api_struct.go index 94a152818..65ce1d7e1 100644 --- a/pkg/base_info/group_api_struct.go +++ b/pkg/base_info/group_api_struct.go @@ -123,9 +123,24 @@ type GetGroupInfoReq struct { } type GetGroupInfoResp struct { CommResp - GroupInfoList []*open_im_sdk.GroupInfo `json:"-"` + GroupInfoList []*GroupInfoAlias `json:"-"` Data []map[string]interface{} `json:"data"` } +type GroupInfoAlias struct { + GroupID string `protobuf:"bytes,1,opt,name=groupID" json:"groupID,omitempty"` + GroupName string `protobuf:"bytes,2,opt,name=groupName" json:"groupName,omitempty"` + Notification string `protobuf:"bytes,3,opt,name=notification" json:"notification,omitempty"` + Introduction string `protobuf:"bytes,4,opt,name=introduction" json:"introduction,omitempty"` + FaceURL string `protobuf:"bytes,5,opt,name=faceURL" json:"faceURL,omitempty"` + OwnerUserID string `protobuf:"bytes,6,opt,name=ownerUserID" json:"ownerUserID,omitempty"` + CreateTime uint32 `protobuf:"varint,7,opt,name=createTime" json:"createTime,omitempty"` + MemberCount uint32 `protobuf:"varint,8,opt,name=memberCount" json:"memberCount,omitempty"` + Ex string `protobuf:"bytes,9,opt,name=ex" json:"ex,omitempty"` + Status int32 `protobuf:"varint,10,opt,name=status" json:"status,omitempty"` + CreatorUserID string `protobuf:"bytes,11,opt,name=creatorUserID" json:"creatorUserID,omitempty"` + GroupType int32 `protobuf:"varint,12,opt,name=groupType" json:"groupType,omitempty"` + NeedVerification int32 `protobuf:"bytes,13,opt,name=needVerification" json:"needVerification,omitempty"` +} type ApplicationGroupResponseReq struct { OperationID string `json:"operationID" binding:"required"`