|
|
|
@ -12,7 +12,6 @@ import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"github.com/go-redis/redis/v8"
|
|
|
|
|
"github.com/gogo/protobuf/sortkeys"
|
|
|
|
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
|
|
|
|
"go.mongodb.org/mongo-driver/mongo"
|
|
|
|
|
"go.mongodb.org/mongo-driver/mongo/options"
|
|
|
|
|
"math/rand"
|
|
|
|
@ -268,7 +267,8 @@ func (d *DataBases) GetUserMsgListByIndex(ID string, index int64) (*UserChat, er
|
|
|
|
|
regex := fmt.Sprintf("/^%s/", ID)
|
|
|
|
|
findOpts := options.Find().SetLimit(1).SetSkip(index).SetSort(bson.M{"uid": 1})
|
|
|
|
|
var msgs []UserChat
|
|
|
|
|
cursor, err := c.Find(ctx, bson.M{"uid": primitive.Regex{Pattern: regex}}, findOpts)
|
|
|
|
|
//primitive.Regex{Pattern: regex}
|
|
|
|
|
cursor, err := c.Find(ctx, bson.M{"uid": bson.M{"$regex": regex}}, findOpts)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, utils.Wrap(err, "")
|
|
|
|
|
}
|
|
|
|
|