Merge remote-tracking branch 'origin/errcode' into errcode

test-errcode
withchao 2 years ago
commit 4faced7d51

@ -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()

@ -125,8 +125,9 @@ func (g *groupDatabase) CreateGroup(ctx context.Context, groups []*relationTb.Gr
for _, groupMember := range groupMembers { for _, groupMember := range groupMembers {
if _, ok := m[groupMember.GroupID]; !ok { if _, ok := m[groupMember.GroupID]; !ok {
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).DelGroupsMemberNum(groupMember.GroupID)
} }
cache.DelJoinedGroupID(groupMember.UserID)
} }
return cache.ExecDel(ctx) return cache.ExecDel(ctx)
}) })

Loading…
Cancel
Save