|
|
|
@ -18,6 +18,7 @@ import (
|
|
|
|
|
pbUser "Open_IM/pkg/proto/user"
|
|
|
|
|
"Open_IM/pkg/utils"
|
|
|
|
|
"context"
|
|
|
|
|
"errors"
|
|
|
|
|
"math/big"
|
|
|
|
|
"net"
|
|
|
|
|
"strconv"
|
|
|
|
@ -25,6 +26,7 @@ import (
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
"google.golang.org/grpc"
|
|
|
|
|
"gorm.io/gorm"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type groupServer struct {
|
|
|
|
@ -1343,7 +1345,7 @@ func (s *groupServer) GetGroups(_ context.Context, req *pbGroup.GetGroupsReq) (*
|
|
|
|
|
}
|
|
|
|
|
if req.GroupID != "" {
|
|
|
|
|
groupInfoDB, err := imdb.GetGroupInfoByGroupID(req.GroupID)
|
|
|
|
|
if err != nil {
|
|
|
|
|
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
|
|
|
|
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.GroupID)
|
|
|
|
|
resp.CommonResp.ErrCode = constant.ErrDB.ErrCode
|
|
|
|
|
resp.CommonResp.ErrMsg = err.Error()
|
|
|
|
@ -1352,7 +1354,14 @@ func (s *groupServer) GetGroups(_ context.Context, req *pbGroup.GetGroupsReq) (*
|
|
|
|
|
resp.GroupNum = 1
|
|
|
|
|
groupInfo := &open_im_sdk.GroupInfo{}
|
|
|
|
|
utils.CopyStructFields(groupInfo, groupInfoDB)
|
|
|
|
|
resp.CMSGroups = append(resp.CMSGroups, &pbGroup.CMSGroup{GroupInfo: groupInfo})
|
|
|
|
|
groupMember, err := imdb.GetGroupOwnerInfoByGroupID(req.GroupID)
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.GroupID)
|
|
|
|
|
resp.CommonResp.ErrCode = constant.ErrDB.ErrCode
|
|
|
|
|
resp.CommonResp.ErrMsg = err.Error()
|
|
|
|
|
return resp, nil
|
|
|
|
|
}
|
|
|
|
|
resp.CMSGroups = append(resp.CMSGroups, &pbGroup.CMSGroup{GroupInfo: groupInfo, GroupOwnerUserName: groupMember.Nickname, GroupOwnerUserID: groupMember.UserID})
|
|
|
|
|
} else {
|
|
|
|
|
groups, err := imdb.GetGroupsByName(req.GroupName, req.Pagination.PageNumber, req.Pagination.ShowNumber)
|
|
|
|
|
if err != nil {
|
|
|
|
|