DEBUG: 消息筛选
This commit is contained in:
parent
2dd39dc530
commit
17e16a4246
@ -143,6 +143,7 @@ export default class Chat {
|
||||
})
|
||||
}
|
||||
async 筛选指定范围的消息({ start, end }) {
|
||||
console.log('筛选指定范围的消息', start, end)
|
||||
const data = await values(this.store)
|
||||
return data.map(item => ({ timestamp: new Date(item.time).getTime(), ...item })).filter(item => {
|
||||
const timestamp = new Date(item.time).getTime()
|
||||
|
@ -183,6 +183,14 @@ clientList.setChannel('chat', {
|
||||
}
|
||||
if (data.type === 'list') {
|
||||
console.log(client.name, '发来消息列表:', data)
|
||||
const last = localStorage.getItem('store-chat-default')
|
||||
const lastTimestamp = new Date(last).getTime()
|
||||
data.list.map(item => ({ timestamp: new Date(item.time).getTime(), ...item })).filter(item => {
|
||||
const timestamp = new Date(item.time).getTime()
|
||||
return timestamp >= lastTimestamp
|
||||
}).forEach(item => {
|
||||
console.log('消息不符合要求的时间区间', item)
|
||||
})
|
||||
chat.合并消息列表(data.list)
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user