feat:下载历史修改

This commit is contained in:
R524809
2026-05-25 18:32:18 +08:00
parent 000d7d8a7f
commit facb569598
5 changed files with 45 additions and 29 deletions
+6 -3
View File
@@ -62,9 +62,12 @@ async function handleAdd(userId, event) {
return { code: 0, data: { _id, ...record } };
}
const MAX_LIST_PAGE_SIZE = 30;
async function handleList(userId, event) {
const { page = 1, pageSize = 20 } = event;
const skip = (page - 1) * pageSize;
const { page = 1, pageSize = MAX_LIST_PAGE_SIZE } = event;
const limit = Math.min(Math.max(1, Number(pageSize) || 1), MAX_LIST_PAGE_SIZE);
const skip = (page - 1) * limit;
const collection = db.collection('download_logs');
@@ -72,7 +75,7 @@ async function handleList(userId, event) {
.where({ userId })
.orderBy('createdAt', 'desc')
.skip(skip)
.limit(pageSize)
.limit(limit)
.get();
if (logs.length === 0) {