发送列表时过滤没有数据的

This commit is contained in:
2023-10-01 18:49:39 +08:00
parent 2083f5f8fa
commit b420d48aaf
1 changed files with 3 additions and 2 deletions

View File

@ -96,10 +96,11 @@
onmessage: async (event, client) => {
const { type, id, channel, list } = JSON.parse(event.data)
if (type === 'get_music_list') {
console.log(client.name, '请求音乐列表:', musicList.list)
const ms = musicList.list.filter(item => item.arrayBuffer)
console.log(client.name, '请求音乐列表:', ms)
clientList.send('base', JSON.stringify({
type: 'set_music_list',
list: musicList.list.map(({ id, name, size, type }) => ({ id, name, size, type }))
list: ms.map(({ id, name, size, type }) => ({ id, name, size, type }))
}))
return
}