feat(playlist_track_all): 增加offset偏移量设置

This commit is contained in:
SnowingFox
2022-01-15 13:06:18 +08:00
parent 4200833a30
commit 845c357aa3
3 changed files with 14 additions and 129 deletions
+3 -1
View File
@@ -9,6 +9,7 @@ module.exports = (query, request) => {
}
//不放在data里面避免请求带上无用的数据
let limit = query.limit
let offset = parseInt(query.offset) || 0
let trackIds
let idsData = Object.create(null)
@@ -23,8 +24,9 @@ module.exports = (query, request) => {
if (typeof limit === 'undefined') {
limit = trackIds.length
}
trackIds.forEach((item, index) => {
if (index < limit) {
if (index >= limit * offset && index < limit * (offset + 1)) {
ids.push(item.id)
}
})