获取可聊天的技师数据
This commit is contained in:
@@ -1010,15 +1010,17 @@ export class GirlData extends BaseData {
|
|||||||
/** 获取所有可聊天的技师 id */
|
/** 获取所有可聊天的技师 id */
|
||||||
public getAllCanChatGirlIds(): number[] {
|
public getAllCanChatGirlIds(): 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.isCanChat(categoryId, girlId)) {
|
if (this.isCanChat(categoryId, girlId) && !seen.has(girlId)) {
|
||||||
|
seen.add(girlId); // 标记已加入
|
||||||
result.push(girlId);
|
result.push(girlId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 排序
|
// 排序
|
||||||
// 1,都存在聊天记录,按照聊天时间从近到远,否则,有聊天记录的排在前面
|
// 1,都存在聊天记录,按照聊天时间从近到远,否则,有聊天记录的排在前面
|
||||||
// 2,都没有聊天记录
|
// 2,都没有聊天记录
|
||||||
|
|||||||
Reference in New Issue
Block a user