test-errcode
wangchuxiao 2 years ago
parent 5da12839fb
commit 255c5ed1c3

@ -546,7 +546,6 @@ func (s *groupServer) GetGroupsInfo(ctx context.Context, req *pbGroup.GetGroupsI
ownerMap := utils.SliceToMap(owners, func(e *relationTb.GroupMemberModel) string { ownerMap := utils.SliceToMap(owners, func(e *relationTb.GroupMemberModel) string {
return e.GroupID return e.GroupID
}) })
log.ZDebug(ctx, "groups return", "groups", groups, "owners", owners, "ownerMap", ownerMap, "groupMemberNumMap", groupMemberNumMap)
resp.GroupInfos = utils.Slice(groups, func(e *relationTb.GroupModel) *sdkws.GroupInfo { resp.GroupInfos = utils.Slice(groups, func(e *relationTb.GroupModel) *sdkws.GroupInfo {
return DbToPbGroupInfo(e, ownerMap[e.GroupID].UserID, groupMemberNumMap[e.GroupID]) return DbToPbGroupInfo(e, ownerMap[e.GroupID].UserID, groupMemberNumMap[e.GroupID])
}) })
@ -621,7 +620,6 @@ func (s *groupServer) GroupApplicationResponse(ctx context.Context, req *pbGroup
} }
func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq) (resp *pbGroup.JoinGroupResp, err error) { func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq) (resp *pbGroup.JoinGroupResp, err error) {
resp = &pbGroup.JoinGroupResp{}
user, err := s.UserCheck.GetUserInfo(ctx, req.InviterUserID) user, err := s.UserCheck.GetUserInfo(ctx, req.InviterUserID)
if err != nil { if err != nil {
return nil, err return nil, err
@ -639,6 +637,7 @@ func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq)
} else if !s.IsNotFound(err) { } else if !s.IsNotFound(err) {
return nil, err return nil, err
} }
resp = &pbGroup.JoinGroupResp{}
if group.NeedVerification == constant.Directly { if group.NeedVerification == constant.Directly {
if group.GroupType == constant.SuperGroup { if group.GroupType == constant.SuperGroup {
return nil, errs.ErrGroupTypeNotSupport.Wrap() return nil, errs.ErrGroupTypeNotSupport.Wrap()

@ -11,6 +11,7 @@ import (
unRelationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation" unRelationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/tx" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/tx"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/unrelation" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/unrelation"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"
"github.com/OpenIMSDK/Open-IM-Server/pkg/utils" "github.com/OpenIMSDK/Open-IM-Server/pkg/utils"
"github.com/dtm-labs/rockscache" "github.com/dtm-labs/rockscache"
"github.com/go-redis/redis/v8" "github.com/go-redis/redis/v8"
@ -122,12 +123,15 @@ func (g *groupDatabase) CreateGroup(ctx context.Context, groups []*relationTb.Gr
} }
m := make(map[string]struct{}) m := make(map[string]struct{})
var cache = g.cache.NewCache() var cache = g.cache.NewCache()
log.ZDebug(ctx, "CreateGroup", "groupMembers", groupMembers)
for _, groupMember := range groupMembers { for _, groupMember := range groupMembers {
if _, ok := m[groupMember.GroupID]; !ok { if _, ok := m[groupMember.GroupID]; !ok {
log.ZDebug(ctx, "CreateGroup", "groupMember", groupMember)
m[groupMember.GroupID] = struct{}{} m[groupMember.GroupID] = struct{}{}
cache = cache.DelGroupMemberIDs(groupMember.GroupID).DelGroupMembersHash(groupMember.GroupID).DelJoinedGroupID(groupMember.UserID).DelGroupsMemberNum(groupMember.GroupID) cache = cache.DelGroupMemberIDs(groupMember.GroupID).DelGroupMembersHash(groupMember.GroupID).DelJoinedGroupID(groupMember.UserID).DelGroupsMemberNum(groupMember.GroupID)
} }
} }
log.ZDebug(ctx, "CreateGroup", "keys", cache.GetPreDelKeys())
return g.cache.ExecDel(ctx) return g.cache.ExecDel(ctx)
}) })
} }

Loading…
Cancel
Save