|
|
@ -41,83 +41,34 @@ type GroupDatabase interface {
|
|
|
|
TakeGroup(ctx context.Context, groupID string) (group *relationtb.GroupModel, err error)
|
|
|
|
TakeGroup(ctx context.Context, groupID string) (group *relationtb.GroupModel, err error)
|
|
|
|
FindGroup(ctx context.Context, groupIDs []string) (groups []*relationtb.GroupModel, err error)
|
|
|
|
FindGroup(ctx context.Context, groupIDs []string) (groups []*relationtb.GroupModel, err error)
|
|
|
|
FindNotDismissedGroup(ctx context.Context, groupIDs []string) (groups []*relationtb.GroupModel, err error)
|
|
|
|
FindNotDismissedGroup(ctx context.Context, groupIDs []string) (groups []*relationtb.GroupModel, err error)
|
|
|
|
SearchGroup(
|
|
|
|
SearchGroup(ctx context.Context, keyword string, pageNumber, showNumber int32) (uint32, []*relationtb.GroupModel, error)
|
|
|
|
ctx context.Context,
|
|
|
|
|
|
|
|
keyword string,
|
|
|
|
|
|
|
|
pageNumber, showNumber int32,
|
|
|
|
|
|
|
|
) (uint32, []*relationtb.GroupModel, error)
|
|
|
|
|
|
|
|
UpdateGroup(ctx context.Context, groupID string, data map[string]any) error
|
|
|
|
UpdateGroup(ctx context.Context, groupID string, data map[string]any) error
|
|
|
|
DismissGroup(ctx context.Context, groupID string, deleteMember bool) error // 解散群,并删除群成员
|
|
|
|
DismissGroup(ctx context.Context, groupID string, deleteMember bool) error // 解散群,并删除群成员
|
|
|
|
GetGroupIDsByGroupType(ctx context.Context, groupType int) (groupIDs []string, err error)
|
|
|
|
GetGroupIDsByGroupType(ctx context.Context, groupType int) (groupIDs []string, err error)
|
|
|
|
// GroupMember
|
|
|
|
// GroupMember
|
|
|
|
TakeGroupMember(
|
|
|
|
TakeGroupMember(ctx context.Context, groupID string, userID string) (groupMember *relationtb.GroupMemberModel, err error)
|
|
|
|
ctx context.Context,
|
|
|
|
|
|
|
|
groupID string,
|
|
|
|
|
|
|
|
userID string,
|
|
|
|
|
|
|
|
) (groupMember *relationtb.GroupMemberModel, err error)
|
|
|
|
|
|
|
|
TakeGroupOwner(ctx context.Context, groupID string) (*relationtb.GroupMemberModel, error)
|
|
|
|
TakeGroupOwner(ctx context.Context, groupID string) (*relationtb.GroupMemberModel, error)
|
|
|
|
FindGroupMember(
|
|
|
|
FindGroupMember(ctx context.Context, groupIDs []string, userIDs []string, roleLevels []int32) ([]*relationtb.GroupMemberModel, error)
|
|
|
|
ctx context.Context,
|
|
|
|
|
|
|
|
groupIDs []string,
|
|
|
|
|
|
|
|
userIDs []string,
|
|
|
|
|
|
|
|
roleLevels []int32,
|
|
|
|
|
|
|
|
) ([]*relationtb.GroupMemberModel, error)
|
|
|
|
|
|
|
|
FindGroupMemberUserID(ctx context.Context, groupID string) ([]string, error)
|
|
|
|
FindGroupMemberUserID(ctx context.Context, groupID string) ([]string, error)
|
|
|
|
FindGroupMemberNum(ctx context.Context, groupID string) (uint32, error)
|
|
|
|
FindGroupMemberNum(ctx context.Context, groupID string) (uint32, error)
|
|
|
|
FindUserManagedGroupID(ctx context.Context, userID string) (groupIDs []string, err error)
|
|
|
|
FindUserManagedGroupID(ctx context.Context, userID string) (groupIDs []string, err error)
|
|
|
|
PageGroupRequest(
|
|
|
|
PageGroupRequest(ctx context.Context, groupIDs []string, pageNumber, showNumber int32) (uint32, []*relationtb.GroupRequestModel, error)
|
|
|
|
ctx context.Context,
|
|
|
|
|
|
|
|
groupIDs []string,
|
|
|
|
PageGetJoinGroup(ctx context.Context, userID string, pageNumber, showNumber int32) (total uint32, totalGroupMembers []*relationtb.GroupMemberModel, err error)
|
|
|
|
pageNumber, showNumber int32,
|
|
|
|
PageGetGroupMember(ctx context.Context, groupID string, pageNumber, showNumber int32) (total uint32, totalGroupMembers []*relationtb.GroupMemberModel, err error)
|
|
|
|
) (uint32, []*relationtb.GroupRequestModel, error)
|
|
|
|
SearchGroupMember(ctx context.Context, keyword string, groupIDs []string, userIDs []string, roleLevels []int32, pageNumber, showNumber int32) (uint32, []*relationtb.GroupMemberModel, error)
|
|
|
|
// PageGroupMember(ctx context.Context, groupIDs []string, userIDs []string, roleLevels []int32, pageNumber,
|
|
|
|
HandlerGroupRequest(ctx context.Context, groupID string, userID string, handledMsg string, handleResult int32, member *relationtb.GroupMemberModel) error
|
|
|
|
// showNumber int32) (uint32, []*relationtb.GroupMemberModel, error)
|
|
|
|
|
|
|
|
PageGetJoinGroup(
|
|
|
|
|
|
|
|
ctx context.Context,
|
|
|
|
|
|
|
|
userID string,
|
|
|
|
|
|
|
|
pageNumber, showNumber int32,
|
|
|
|
|
|
|
|
) (total uint32, totalGroupMembers []*relationtb.GroupMemberModel, err error)
|
|
|
|
|
|
|
|
PageGetGroupMember(
|
|
|
|
|
|
|
|
ctx context.Context,
|
|
|
|
|
|
|
|
groupID string,
|
|
|
|
|
|
|
|
pageNumber, showNumber int32,
|
|
|
|
|
|
|
|
) (total uint32, totalGroupMembers []*relationtb.GroupMemberModel, err error)
|
|
|
|
|
|
|
|
SearchGroupMember(
|
|
|
|
|
|
|
|
ctx context.Context,
|
|
|
|
|
|
|
|
keyword string,
|
|
|
|
|
|
|
|
groupIDs []string,
|
|
|
|
|
|
|
|
userIDs []string,
|
|
|
|
|
|
|
|
roleLevels []int32,
|
|
|
|
|
|
|
|
pageNumber, showNumber int32,
|
|
|
|
|
|
|
|
) (uint32, []*relationtb.GroupMemberModel, error)
|
|
|
|
|
|
|
|
HandlerGroupRequest(
|
|
|
|
|
|
|
|
ctx context.Context,
|
|
|
|
|
|
|
|
groupID string,
|
|
|
|
|
|
|
|
userID string,
|
|
|
|
|
|
|
|
handledMsg string,
|
|
|
|
|
|
|
|
handleResult int32,
|
|
|
|
|
|
|
|
member *relationtb.GroupMemberModel,
|
|
|
|
|
|
|
|
) error
|
|
|
|
|
|
|
|
DeleteGroupMember(ctx context.Context, groupID string, userIDs []string) error
|
|
|
|
DeleteGroupMember(ctx context.Context, groupID string, userIDs []string) error
|
|
|
|
MapGroupMemberUserID(ctx context.Context, groupIDs []string) (map[string]*relationtb.GroupSimpleUserID, error)
|
|
|
|
MapGroupMemberUserID(ctx context.Context, groupIDs []string) (map[string]*relationtb.GroupSimpleUserID, error)
|
|
|
|
MapGroupMemberNum(ctx context.Context, groupIDs []string) (map[string]uint32, error)
|
|
|
|
MapGroupMemberNum(ctx context.Context, groupIDs []string) (map[string]uint32, error)
|
|
|
|
TransferGroupOwner(
|
|
|
|
TransferGroupOwner(ctx context.Context, groupID string, oldOwnerUserID, newOwnerUserID string, roleLevel int32) error // 转让群
|
|
|
|
ctx context.Context,
|
|
|
|
|
|
|
|
groupID string,
|
|
|
|
|
|
|
|
oldOwnerUserID, newOwnerUserID string,
|
|
|
|
|
|
|
|
roleLevel int32,
|
|
|
|
|
|
|
|
) error // 转让群
|
|
|
|
|
|
|
|
UpdateGroupMember(ctx context.Context, groupID string, userID string, data map[string]any) error
|
|
|
|
UpdateGroupMember(ctx context.Context, groupID string, userID string, data map[string]any) error
|
|
|
|
UpdateGroupMembers(ctx context.Context, data []*relationtb.BatchUpdateGroupMember) error
|
|
|
|
UpdateGroupMembers(ctx context.Context, data []*relationtb.BatchUpdateGroupMember) error
|
|
|
|
// GroupRequest
|
|
|
|
// GroupRequest
|
|
|
|
CreateGroupRequest(ctx context.Context, requests []*relationtb.GroupRequestModel) error
|
|
|
|
CreateGroupRequest(ctx context.Context, requests []*relationtb.GroupRequestModel) error
|
|
|
|
TakeGroupRequest(ctx context.Context, groupID string, userID string) (*relationtb.GroupRequestModel, error)
|
|
|
|
TakeGroupRequest(ctx context.Context, groupID string, userID string) (*relationtb.GroupRequestModel, error)
|
|
|
|
FindGroupRequests(ctx context.Context, groupID string, userIDs []string) (int64, []*relationtb.GroupRequestModel, error)
|
|
|
|
FindGroupRequests(ctx context.Context, groupID string, userIDs []string) (int64, []*relationtb.GroupRequestModel, error)
|
|
|
|
PageGroupRequestUser(
|
|
|
|
PageGroupRequestUser(ctx context.Context, userID string, pageNumber, showNumber int32) (uint32, []*relationtb.GroupRequestModel, error)
|
|
|
|
ctx context.Context,
|
|
|
|
|
|
|
|
userID string,
|
|
|
|
|
|
|
|
pageNumber, showNumber int32,
|
|
|
|
|
|
|
|
) (uint32, []*relationtb.GroupRequestModel, error)
|
|
|
|
|
|
|
|
// SuperGroupModelInterface
|
|
|
|
// SuperGroupModelInterface
|
|
|
|
FindSuperGroup(ctx context.Context, groupIDs []string) ([]*unrelationtb.SuperGroupModel, error)
|
|
|
|
FindSuperGroup(ctx context.Context, groupIDs []string) ([]*unrelationtb.SuperGroupModel, error)
|
|
|
|
FindJoinSuperGroup(ctx context.Context, userID string) ([]string, error)
|
|
|
|
FindJoinSuperGroup(ctx context.Context, userID string) ([]string, error)
|
|
|
@ -310,12 +261,22 @@ func (g *groupDatabase) PageGroupRequest(
|
|
|
|
return g.groupRequestDB.PageGroup(ctx, groupIDs, pageNumber, showNumber)
|
|
|
|
return g.groupRequestDB.PageGroup(ctx, groupIDs, pageNumber, showNumber)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (g *groupDatabase) FindGroupMember(
|
|
|
|
func (g *groupDatabase) FindGroupMember(ctx context.Context, groupIDs []string, userIDs []string, roleLevels []int32) (totalGroupMembers []*relationtb.GroupMemberModel, err error) {
|
|
|
|
ctx context.Context,
|
|
|
|
if len(groupIDs) == 0 && len(roleLevels) == 0 && len(userIDs) == 1 {
|
|
|
|
groupIDs []string,
|
|
|
|
gIDs, err := g.cache.GetJoinedGroupIDs(ctx, userIDs[0])
|
|
|
|
userIDs []string,
|
|
|
|
if err != nil {
|
|
|
|
roleLevels []int32,
|
|
|
|
return nil, err
|
|
|
|
) (totalGroupMembers []*relationtb.GroupMemberModel, err error) {
|
|
|
|
}
|
|
|
|
|
|
|
|
var res []*relationtb.GroupMemberModel
|
|
|
|
|
|
|
|
for _, groupID := range gIDs {
|
|
|
|
|
|
|
|
v, err := g.cache.GetGroupMemberInfo(ctx, groupID, userIDs[0])
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
res = append(res, v)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return res, nil
|
|
|
|
|
|
|
|
}
|
|
|
|
if len(roleLevels) == 0 {
|
|
|
|
if len(roleLevels) == 0 {
|
|
|
|
for _, groupID := range groupIDs {
|
|
|
|
for _, groupID := range groupIDs {
|
|
|
|
groupMembers, err := g.cache.GetGroupMembersInfo(ctx, groupID, userIDs)
|
|
|
|
groupMembers, err := g.cache.GetGroupMembersInfo(ctx, groupID, userIDs)
|
|
|
|