mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-06-26 14:19:38 +08:00
Merge branch 'openimsdk:main' into feat/etcd-pwd
This commit is contained in:
commit
df6a31cdd8
@ -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"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
|
||||
"github.com/openimsdk/tools/db/mongoutil"
|
||||
"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) {
|
||||
@ -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)
|
||||
}
|
||||
|
@ -16,17 +16,19 @@ package mgo
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"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/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/mongo"
|
||||
"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) {
|
||||
@ -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}
|
||||
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)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user