ingress
This commit is contained in:
parent
a40a9da324
commit
29ca352766
|
@ -2,7 +2,6 @@ package mongo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/db"
|
|
||||||
server_api_params "Open_IM/pkg/proto/sdk_ws"
|
server_api_params "Open_IM/pkg/proto/sdk_ws"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
@ -16,10 +15,20 @@ var (
|
||||||
Client *mongo.Client
|
Client *mongo.Client
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type MsgInfo struct {
|
||||||
|
SendTime int64
|
||||||
|
Msg []byte
|
||||||
|
}
|
||||||
|
|
||||||
|
type UserChat struct {
|
||||||
|
UID string
|
||||||
|
Msg []MsgInfo
|
||||||
|
}
|
||||||
|
|
||||||
func GetUserAllChat(uid string) {
|
func GetUserAllChat(uid string) {
|
||||||
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
|
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
|
||||||
collection := Client.Database(config.Config.Mongo.DBDatabase).Collection("msg")
|
collection := Client.Database(config.Config.Mongo.DBDatabase).Collection("msg")
|
||||||
var userChatList []db.UserChat
|
var userChatList []UserChat
|
||||||
uid = uid + ":"
|
uid = uid + ":"
|
||||||
filter := bson.M{"uid": bson.M{"$regex": uid}}
|
filter := bson.M{"uid": bson.M{"$regex": uid}}
|
||||||
//filter := bson.M{"uid": "17726378428:0"}
|
//filter := bson.M{"uid": "17726378428:0"}
|
||||||
|
|
Loading…
Reference in New Issue