mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-05-22 04:39:19 +08:00
test cron
This commit is contained in:
parent
9025d8bd90
commit
e4ed6dde0c
@ -264,20 +264,21 @@ func (d *DataBases) GetUserMsgListByIndex(ID string, index int64) (*UserChat, er
|
|||||||
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat)
|
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat)
|
||||||
regex := fmt.Sprintf("^%s", ID)
|
regex := fmt.Sprintf("^%s", ID)
|
||||||
findOpts := options.Find().SetLimit(1).SetSkip(index).SetSort(bson.M{"uid": 1})
|
findOpts := options.Find().SetLimit(1).SetSkip(index).SetSort(bson.M{"uid": 1})
|
||||||
var msgs []*UserChat
|
var msg UserChat
|
||||||
cursor, err := c.Find(ctx, bson.M{"uid": bson.M{"$regex": regex}}, findOpts)
|
cursor, err := c.Find(ctx, bson.M{"uid": bson.M{"$regex": regex}}, findOpts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, utils.Wrap(err, "")
|
return nil, utils.Wrap(err, "")
|
||||||
}
|
}
|
||||||
err = cursor.Decode(&msgs)
|
err = cursor.Decode(&msg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, utils.Wrap(err, "")
|
return nil, utils.Wrap(err, fmt.Sprintf("cursor is %s", cursor.Current.String()))
|
||||||
}
|
|
||||||
if len(msgs) > 0 {
|
|
||||||
return msgs[0], err
|
|
||||||
} else {
|
|
||||||
return nil, errors.New("get msg list failed")
|
|
||||||
}
|
}
|
||||||
|
//if len(msgs) > 0 {
|
||||||
|
// return msgs[0], err
|
||||||
|
//} else {
|
||||||
|
// return nil, errors.New("get msg list failed")
|
||||||
|
//}
|
||||||
|
return &msg, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *DataBases) DelMongoMsgs(IDList []string) error {
|
func (d *DataBases) DelMongoMsgs(IDList []string) error {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user