获取所有解锁技师,去重
This commit is contained in:
@@ -835,11 +835,13 @@ export class GirlData extends BaseData {
|
|||||||
/** 获取所有已经解锁技师的 id,不区分技师的付费类型 */
|
/** 获取所有已经解锁技师的 id,不区分技师的付费类型 */
|
||||||
public getAllReleaseGirlIds(): number[] {
|
public getAllReleaseGirlIds(): number[] {
|
||||||
const result: number[] = [];
|
const result: number[] = [];
|
||||||
|
const seen = new Set<number>(); // 用来去重
|
||||||
const cats = this.ensureCategories();
|
const cats = this.ensureCategories();
|
||||||
|
// 遍历
|
||||||
for (const [categoryId, bucket] of cats.entries()) {
|
for (const [categoryId, bucket] of cats.entries()) {
|
||||||
for (const girlId of bucket.girlIds) {
|
for (const girlId of bucket.girlIds) {
|
||||||
if (this.getIsRelease(categoryId, girlId)) {
|
if (this.getIsRelease(categoryId, girlId) && !seen.has(girlId)) {
|
||||||
|
seen.add(girlId); // 标记已加入
|
||||||
result.push(girlId);
|
result.push(girlId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user