feat: 增加收藏、下载种子数据功能
This commit is contained in:
@@ -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、seed 或 stats)',
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user