mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-11-03 18:52:15 +08:00
sort version
This commit is contained in:
parent
8b32ce7144
commit
1ef057bbe2
@ -12,6 +12,11 @@ import (
|
|||||||
"github.com/openimsdk/protocol/sdkws"
|
"github.com/openimsdk/protocol/sdkws"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func (s *groupServer) BatchGetIncrementalGroupMember(ctx context.Context, req *pbgroup.BatchGetIncrementalGroupMemberReq) (*pbgroup.BatchGetIncrementalGroupMemberResp, error) {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
func (s *groupServer) GetFullGroupMemberUserIDs(ctx context.Context, req *pbgroup.GetFullGroupMemberUserIDsReq) (*pbgroup.GetFullGroupMemberUserIDsResp, error) {
|
func (s *groupServer) GetFullGroupMemberUserIDs(ctx context.Context, req *pbgroup.GetFullGroupMemberUserIDsReq) (*pbgroup.GetFullGroupMemberUserIDsResp, error) {
|
||||||
vl, err := s.db.FindMaxGroupMemberVersionCache(ctx, req.GroupID)
|
vl, err := s.db.FindMaxGroupMemberVersionCache(ctx, req.GroupID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@ -109,7 +109,13 @@ func (f *FriendMgo) UpdateByMap(ctx context.Context, ownerUserID string, friendU
|
|||||||
return mongoutil.IncrVersion(func() error {
|
return mongoutil.IncrVersion(func() error {
|
||||||
return mongoutil.UpdateOne(ctx, f.coll, filter, bson.M{"$set": args}, true)
|
return mongoutil.UpdateOne(ctx, f.coll, filter, bson.M{"$set": args}, true)
|
||||||
}, func() error {
|
}, func() error {
|
||||||
return f.owner.IncrVersion(ctx, ownerUserID, []string{friendUserID}, model.VersionStateUpdate)
|
var friendUserIDs []string
|
||||||
|
if f.IsUpdateIsPinned(args) {
|
||||||
|
friendUserIDs = []string{model.VersionSortChangeID, friendUserID}
|
||||||
|
} else {
|
||||||
|
friendUserIDs = []string{friendUserID}
|
||||||
|
}
|
||||||
|
return f.owner.IncrVersion(ctx, ownerUserID, friendUserIDs, model.VersionStateUpdate)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,7 +220,7 @@ func (f *FriendMgo) FindFriendUserIDs(ctx context.Context, ownerUserID string) (
|
|||||||
|
|
||||||
func (f *FriendMgo) UpdateFriends(ctx context.Context, ownerUserID string, friendUserIDs []string, val map[string]any) error {
|
func (f *FriendMgo) UpdateFriends(ctx context.Context, ownerUserID string, friendUserIDs []string, val map[string]any) error {
|
||||||
// Ensure there are IDs to update
|
// Ensure there are IDs to update
|
||||||
if len(friendUserIDs) == 0 {
|
if len(friendUserIDs) == 0 || len(val) == 0 {
|
||||||
return nil // Or return an error if you expect there to always be IDs
|
return nil // Or return an error if you expect there to always be IDs
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,7 +236,13 @@ func (f *FriendMgo) UpdateFriends(ctx context.Context, ownerUserID string, frien
|
|||||||
return mongoutil.IncrVersion(func() error {
|
return mongoutil.IncrVersion(func() error {
|
||||||
return mongoutil.Ignore(mongoutil.UpdateMany(ctx, f.coll, filter, update))
|
return mongoutil.Ignore(mongoutil.UpdateMany(ctx, f.coll, filter, update))
|
||||||
}, func() error {
|
}, func() error {
|
||||||
return f.owner.IncrVersion(ctx, ownerUserID, friendUserIDs, model.VersionStateUpdate)
|
var userIDs []string
|
||||||
|
if f.IsUpdateIsPinned(val) {
|
||||||
|
userIDs = append([]string{model.VersionSortChangeID}, friendUserIDs...)
|
||||||
|
} else {
|
||||||
|
userIDs = friendUserIDs
|
||||||
|
}
|
||||||
|
return f.owner.IncrVersion(ctx, ownerUserID, userIDs, model.VersionStateUpdate)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,3 +260,11 @@ func (f *FriendMgo) FindFriendUserID(ctx context.Context, friendUserID string) (
|
|||||||
func (f *FriendMgo) IncrVersion(ctx context.Context, ownerUserID string, friendUserIDs []string, state int32) error {
|
func (f *FriendMgo) IncrVersion(ctx context.Context, ownerUserID string, friendUserIDs []string, state int32) error {
|
||||||
return f.owner.IncrVersion(ctx, ownerUserID, friendUserIDs, state)
|
return f.owner.IncrVersion(ctx, ownerUserID, friendUserIDs, state)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (f *FriendMgo) IsUpdateIsPinned(data map[string]any) bool {
|
||||||
|
if data == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
_, ok := data["is_pinned"]
|
||||||
|
return ok
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user