聊天:最近私聊历史相关逻辑
This commit is contained in:
@@ -51,6 +51,16 @@ export default class PrivateMessage extends BaseModel {
|
||||
const result = await PrivateMessageModel.find({ roomId, seqId: { $lt: fromSeqId } }).sort({ seqId: -1 }).limit(count).lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async getMsgsByTime(roomId: string, time: Date, count: number) {
|
||||
const result = await PrivateMessageModel.find({ roomId, createdAt: { $gt: time } }).sort({ seqId: -1 }).limit(count).lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async getMsgByRooms(roomIds: string[], count: number) {
|
||||
const result = await PrivateMessageModel.find({ roomId: { $in: roomIds } }).sort({ seqId: -1 }).limit(count).lean();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user