mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-12 13:05:58 +08:00
fix: optimize friend and group applications (#3389)
* pb
* fix: Modifying other fields while setting IsPrivateChat does not take effect
* fix: quote message error revoke
* refactoring scheduled tasks
* refactoring scheduled tasks
* refactoring scheduled tasks
* refactoring scheduled tasks
* refactoring scheduled tasks
* refactoring scheduled tasks
* upgrading pkg tools
* fix
* fix
* optimize log output
* feat: support GetLastMessage
* feat: support GetLastMessage
* feat: s3 switch
* feat: s3 switch
* fix: GetUsersOnline
* feat: SendBusinessNotification supported configuration parameters
* feat: SendBusinessNotification supported configuration parameters
* feat: SendBusinessNotification supported configuration parameters
* feat: seq conversion failed without exiting
* fix: DeleteDoc crash
* fix: fill send time
* fix: fill send time
* fix: crash caused by withdrawing messages from users who have left the group
* fix: user msg timestamp
* seq read config
* seq read config
* fix: the source message of the reference is withdrawn, and the referenced message is deleted
* feat: optimize the default notification.yml
* fix: shouldPushOffline
* fix: the sorting is wrong after canceling the administrator in group settings
* feat: Sending messages supports returning fields modified by webhook
* feat: Sending messages supports returning fields modified by webhook
* feat: Sending messages supports returning fields modified by webhook
* fix: oss specifies content-type when uploading
* fix: the version number contains a line break
* fix: the version number contains a line break
* feat: GetConversationsHasReadAndMaxSeq support pinned
* feat: GetConversationsHasReadAndMaxSeq support pinned
* feat: GetConversationsHasReadAndMaxSeq support pinned
* fix: transferring the group owner to a muted member, incremental version error
* feat: unified conversion code
* feat: update gomake
* fix: in standalone mode, the user online status is wrong
* fix: add permission check
* fix: add permission check
* fix: add rpc interface permission check
* fix: CreateGroupChatConversations
* feat: optimize friend and group applications
* feat: optimize friend and group applications
* feat: optimize friend and group applications
* feat: optimize friend and group applications
* fix: optimize friend and group applications
(cherry picked from commit 812c1e4127)
This commit is contained in:
@@ -16,15 +16,18 @@ package mgo
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"go.mongodb.org/mongo-driver/mongo/options"
|
||||||
|
|
||||||
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/database"
|
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/database"
|
||||||
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/model"
|
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/model"
|
||||||
"go.mongodb.org/mongo-driver/mongo/options"
|
|
||||||
|
"go.mongodb.org/mongo-driver/bson"
|
||||||
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
|
|
||||||
"github.com/openimsdk/tools/db/mongoutil"
|
"github.com/openimsdk/tools/db/mongoutil"
|
||||||
"github.com/openimsdk/tools/db/pagination"
|
"github.com/openimsdk/tools/db/pagination"
|
||||||
"go.mongodb.org/mongo-driver/bson"
|
|
||||||
"go.mongodb.org/mongo-driver/mongo"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewFriendRequestMongo(db *mongo.Database) (database.FriendRequest, error) {
|
func NewFriendRequestMongo(db *mongo.Database) (database.FriendRequest, error) {
|
||||||
@@ -134,7 +137,7 @@ func (f *FriendRequestMgo) Take(ctx context.Context, fromUserID, toUserID string
|
|||||||
func (f *FriendRequestMgo) GetUnhandledCount(ctx context.Context, userID string, ts int64) (int64, error) {
|
func (f *FriendRequestMgo) GetUnhandledCount(ctx context.Context, userID string, ts int64) (int64, error) {
|
||||||
filter := bson.M{"to_user_id": userID, "handle_result": 0}
|
filter := bson.M{"to_user_id": userID, "handle_result": 0}
|
||||||
if ts != 0 {
|
if ts != 0 {
|
||||||
filter["req_time"] = bson.M{"$gt": ts}
|
filter["create_time"] = bson.M{"$gt": time.Unix(ts, 0)}
|
||||||
}
|
}
|
||||||
return mongoutil.Count(ctx, f.coll, filter)
|
return mongoutil.Count(ctx, f.coll, filter)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,17 +16,19 @@ package mgo
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/database"
|
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/database"
|
||||||
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/model"
|
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/model"
|
||||||
"github.com/openimsdk/tools/utils/datautil"
|
"github.com/openimsdk/tools/utils/datautil"
|
||||||
|
|
||||||
"github.com/openimsdk/tools/db/mongoutil"
|
|
||||||
"github.com/openimsdk/tools/db/pagination"
|
|
||||||
"github.com/openimsdk/tools/errs"
|
|
||||||
"go.mongodb.org/mongo-driver/bson"
|
"go.mongodb.org/mongo-driver/bson"
|
||||||
"go.mongodb.org/mongo-driver/mongo"
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
"go.mongodb.org/mongo-driver/mongo/options"
|
"go.mongodb.org/mongo-driver/mongo/options"
|
||||||
|
|
||||||
|
"github.com/openimsdk/tools/db/mongoutil"
|
||||||
|
"github.com/openimsdk/tools/db/pagination"
|
||||||
|
"github.com/openimsdk/tools/errs"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewGroupRequestMgo(db *mongo.Database) (database.GroupRequest, error) {
|
func NewGroupRequestMgo(db *mongo.Database) (database.GroupRequest, error) {
|
||||||
@@ -107,7 +109,7 @@ func (g *GroupRequestMgo) GetUnhandledCount(ctx context.Context, groupIDs []stri
|
|||||||
}
|
}
|
||||||
filter := bson.M{"group_id": bson.M{"$in": groupIDs}, "handle_result": 0}
|
filter := bson.M{"group_id": bson.M{"$in": groupIDs}, "handle_result": 0}
|
||||||
if ts != 0 {
|
if ts != 0 {
|
||||||
filter["req_time"] = bson.M{"$gt": ts}
|
filter["req_time"] = bson.M{"$gt": time.Unix(ts, 0)}
|
||||||
}
|
}
|
||||||
return mongoutil.Count(ctx, g.coll, filter)
|
return mongoutil.Count(ctx, g.coll, filter)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user