收藏功能&排行榜功能

This commit is contained in:
2025-10-27 17:33:09 +08:00
parent 3cff8f8f28
commit 441d823341
50 changed files with 3809 additions and 4489 deletions
+29 -1
View File
@@ -1533,7 +1533,35 @@ export class GirlData extends BaseData {
}
// 返回结果
return result;
}
}
/** 获取按收藏时间排序的收藏技师ID(最新的在前) */
public getAllBookmarkGirlIdsSortedByTime(): number[] {
const result: Array<{
girlId: number;
bookmarkTime: number;
category: string;
}> = [];
const seen = new Set<number>(); // 用来去重
const cats = this.ensureCategories();
// 收集所有收藏的女孩ID及其收藏时间
for (const [categoryId, bucket] of cats.entries()) {
for (const girlId of bucket.girlIds) {
if (this.isBookmarkGirl(categoryId, girlId) && !seen.has(girlId)) {
seen.add(girlId); // 标记已加入
const bookmarkTime = this.getBookmarkTime(categoryId, girlId);
result.push({ girlId, bookmarkTime, category: categoryId });
}
}
}
// 按收藏时间降序排序(最新的在前)
result.sort((a, b) => b.bookmarkTime - a.bookmarkTime);
// 返回排序后的ID数组
return result.map((item) => item.girlId);
}
/** --------------------------------------------------------- 技师的其他数据 --------------------------------------------------------- */