mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-07 10:35:59 +08:00
new feat: sync designated model data (#668)
* new feature: add batch send msg * new feature: add batch send msg * new feature: add batch send msg * new feature: add batch send msg * new feature: add batch send msg * new feature: add batch send msg * fix bug: multiple gateway kick user * fix bug: multiple gateway kick user * fix bug: multiple gateway kick user * fix bug: multiple gateway kick user * fix bug: multiple gateway kick user * MsgDestructTime * fix bug: msg destruct sql * fix bug: msg destruct * fix bug: msg destruct * fix bug: msg destruct sql * fix bug: msg destruct sql * fix bug: msg destruct sql * fix bug: msg destruct sql * debug: print stack * debug: print stack * debug: print stack * fix bug: msg destruct sql Signed-off-by: wangchuxiao <wangchuxiao97@outlook.com> * fix bug: msg notification self 2 self push twice * fix bug: heartbeat get self notification * fix bug: init grpc conn in one process * fix bug: grpc conn Signed-off-by: wangchuxiao <wangchuxiao97@outlook.com> * fix bug: zk client recreate node when reconn * fix bug: set friend mark args error * fix bug: rpc client intercepter called twice Signed-off-by: wangchuxiao <wangchuxiao97@outlook.com> * cicd: robot automated Change Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * test: document msg num set 100 * new feat: sync designated model * new feat: sync designated model * new feat: sync designated model * new feat: sync designated model * new feat: sync designated model * new feat: sync designated model * new feat: sync designated model * merge code * merge code --------- Signed-off-by: wangchuxiao <wangchuxiao97@outlook.com> Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: wangchuxiao-dev <wangchuxiao-dev@users.noreply.github.com>
This commit is contained in:
@@ -75,6 +75,7 @@ type FriendDatabase interface {
|
||||
friendUserIDs []string,
|
||||
) (friends []*relation.FriendModel, err error)
|
||||
FindFriendUserIDs(ctx context.Context, ownerUserID string) (friendUserIDs []string, err error)
|
||||
FindBothFriendRequests(ctx context.Context, fromUserID, toUserID string) (friends []*relation.FriendRequestModel, err error)
|
||||
}
|
||||
|
||||
type friendDatabase struct {
|
||||
@@ -363,3 +364,7 @@ func (f *friendDatabase) FindFriendUserIDs(
|
||||
) (friendUserIDs []string, err error) {
|
||||
return f.cache.GetFriendIDs(ctx, ownerUserID)
|
||||
}
|
||||
|
||||
func (f *friendDatabase) FindBothFriendRequests(ctx context.Context, fromUserID, toUserID string) (friends []*relation.FriendRequestModel, err error) {
|
||||
return f.friendRequest.FindBothFriendRequests(ctx, fromUserID, toUserID)
|
||||
}
|
||||
|
||||
@@ -110,6 +110,7 @@ type GroupDatabase interface {
|
||||
// GroupRequest
|
||||
CreateGroupRequest(ctx context.Context, requests []*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)
|
||||
PageGroupRequestUser(
|
||||
ctx context.Context,
|
||||
userID string,
|
||||
@@ -576,3 +577,7 @@ func (g *groupDatabase) CountTotal(ctx context.Context, before *time.Time) (coun
|
||||
func (g *groupDatabase) CountRangeEverydayTotal(ctx context.Context, start time.Time, end time.Time) (map[string]int64, error) {
|
||||
return g.groupDB.CountRangeEverydayTotal(ctx, start, end)
|
||||
}
|
||||
|
||||
func (g *groupDatabase) FindGroupRequests(ctx context.Context, groupID string, userIDs []string) (int64, []*relationTb.GroupRequestModel, error) {
|
||||
return g.groupRequestDB.FindGroupRequests(ctx, groupID, userIDs)
|
||||
}
|
||||
|
||||
@@ -147,3 +147,14 @@ func (f *FriendRequestGorm) FindFromUserID(
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
func (f *FriendRequestGorm) FindBothFriendRequests(ctx context.Context, fromUserID, toUserID string) (friends []*relation.FriendRequestModel, err error) {
|
||||
err = utils.Wrap(
|
||||
f.db(ctx).
|
||||
Where("(from_user_id = ? AND to_user_id = ?) OR (from_user_id = ? AND to_user_id = ?)", fromUserID, toUserID, toUserID, fromUserID).
|
||||
Find(&friends).
|
||||
Error,
|
||||
"",
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -110,3 +110,8 @@ func (g *GroupRequestGorm) PageGroup(
|
||||
showNumber,
|
||||
)
|
||||
}
|
||||
|
||||
func (g *GroupRequestGorm) FindGroupRequests(ctx context.Context, groupID string, userIDs []string) (total int64, groupRequests []*relation.GroupRequestModel, err error) {
|
||||
err = g.DB.WithContext(ctx).Where("group_id = ? and user_id in ?", groupID, userIDs).Find(&groupRequests).Error
|
||||
return int64(len(groupRequests)), groupRequests, utils.Wrap(err, utils.GetSelfFuncName())
|
||||
}
|
||||
|
||||
@@ -61,6 +61,6 @@ type FriendRequestModelInterface interface {
|
||||
fromUserID string,
|
||||
pageNumber, showNumber int32,
|
||||
) (friendRequests []*FriendRequestModel, total int64, err error)
|
||||
|
||||
FindBothFriendRequests(ctx context.Context, fromUserID, toUserID string) (friends []*FriendRequestModel, err error)
|
||||
NewTx(tx any) FriendRequestModelInterface
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ type GroupRequestModelInterface interface {
|
||||
Delete(ctx context.Context, groupID string, userID string) (err error)
|
||||
UpdateHandler(ctx context.Context, groupID string, userID string, handledMsg string, handleResult int32) (err error)
|
||||
Take(ctx context.Context, groupID string, userID string) (groupRequest *GroupRequestModel, err error)
|
||||
FindGroupRequests(ctx context.Context, groupID string, userIDs []string) (int64, []*GroupRequestModel, error)
|
||||
Page(
|
||||
ctx context.Context,
|
||||
userID string,
|
||||
|
||||
Reference in New Issue
Block a user