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
+9
View File
@@ -5,6 +5,13 @@ cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV });
const VALID_STATUS = new Set(['draft', 'active', 'hidden']);
const STATUS_ORDER = { draft: 0, hidden: 1, active: 2 };
function mergeSeedStats(items) {
for (const item of items) {
item.likes = (item.likes || 0) + (item.likes_seed || 0);
item.downloads = (item.downloads || 0) + (item.downloads_seed || 0);
}
}
exports.main = async (event) => {
try {
const db = cloud.database();
@@ -54,6 +61,8 @@ exports.main = async (event) => {
else if (item.status === 'hidden') stats.hidden++;
}
mergeSeedStats(data);
return {
success: true,
data,