feat: 增加收藏、下载种子数据功能

This commit is contained in:
R524809
2026-05-11 12:38:10 +08:00
parent debecd67c6
commit 39b8e01c23
11 changed files with 521 additions and 21 deletions
+30 -1
View File
@@ -74,11 +74,40 @@ function buildUpdateData(db, patch) {
hasField = true;
}
if (patch.likes_seed !== undefined) {
const v = toInt(patch.likes_seed, -1);
if (v < 0) return { id, ok: false, error: 'likes_seed 须为非负整数' };
data.likes_seed = v;
hasField = true;
}
if (patch.downloads_seed !== undefined) {
const v = toInt(patch.downloads_seed, -1);
if (v < 0)
return { id, ok: false, error: 'downloads_seed 须为非负整数' };
data.downloads_seed = v;
hasField = true;
}
if (patch.likes !== undefined) {
const v = toInt(patch.likes, -1);
if (v < 0) return { id, ok: false, error: 'likes 须为非负整数' };
data.likes = v;
hasField = true;
}
if (patch.downloads !== undefined) {
const v = toInt(patch.downloads, -1);
if (v < 0) return { id, ok: false, error: 'downloads 须为非负整数' };
data.downloads = v;
hasField = true;
}
if (!hasField) {
return {
id,
ok: false,
error: '未包含可更新字段(ageMin/ageMax 或 tags',
error: '未包含可更新字段(ageMin/ageMax、tags、seedstats',
};
}