|
|
@ -1166,9 +1166,6 @@ func (m *MsgMongoDriver) searchMessage(ctx context.Context, req *msg.SearchMessa
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return 0, nil, err
|
|
|
|
return 0, nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if len(msgsDocs) == 0 {
|
|
|
|
|
|
|
|
return 0, nil, errs.Wrap(mongo.ErrNoDocuments)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
msgs := make([]*table.MsgInfoModel, 0)
|
|
|
|
msgs := make([]*table.MsgInfoModel, 0)
|
|
|
|
for index := range msgsDocs {
|
|
|
|
for index := range msgsDocs {
|
|
|
|
msgInfo := msgsDocs[index].Msg
|
|
|
|
msgInfo := msgsDocs[index].Msg
|
|
|
@ -1207,7 +1204,9 @@ func (m *MsgMongoDriver) searchMessage(ctx context.Context, req *msg.SearchMessa
|
|
|
|
}
|
|
|
|
}
|
|
|
|
start := (req.Pagination.PageNumber - 1) * req.Pagination.ShowNumber
|
|
|
|
start := (req.Pagination.PageNumber - 1) * req.Pagination.ShowNumber
|
|
|
|
n := int32(len(msgs))
|
|
|
|
n := int32(len(msgs))
|
|
|
|
if start+req.Pagination.ShowNumber < n {
|
|
|
|
if start >= n {
|
|
|
|
|
|
|
|
return n, []*table.MsgInfoModel{}, nil
|
|
|
|
|
|
|
|
} else if start+req.Pagination.ShowNumber < n {
|
|
|
|
msgs = msgs[start : start+req.Pagination.ShowNumber]
|
|
|
|
msgs = msgs[start : start+req.Pagination.ShowNumber]
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
msgs = msgs[start:]
|
|
|
|
msgs = msgs[start:]
|
|
|
|