|
|
|
@ -16,15 +16,18 @@ package mgo
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"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/model"
|
|
|
|
|
"go.mongodb.org/mongo-driver/mongo/options"
|
|
|
|
|
|
|
|
|
|
"github.com/openimsdk/tools/db/mongoutil"
|
|
|
|
|
"github.com/openimsdk/tools/db/pagination"
|
|
|
|
|
"go.mongodb.org/mongo-driver/bson"
|
|
|
|
|
"go.mongodb.org/mongo-driver/mongo"
|
|
|
|
|
|
|
|
|
|
"github.com/openimsdk/tools/db/mongoutil"
|
|
|
|
|
"github.com/openimsdk/tools/db/pagination"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
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) {
|
|
|
|
|
filter := bson.M{"to_user_id": userID, "handle_result": 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)
|
|
|
|
|
}
|
|
|
|
|