diff --git a/assets/Scripts/chat18x/data/GirlData.ts b/assets/Scripts/chat18x/data/GirlData.ts index 7aaac116..66643e11 100644 --- a/assets/Scripts/chat18x/data/GirlData.ts +++ b/assets/Scripts/chat18x/data/GirlData.ts @@ -418,18 +418,14 @@ export class GirlData extends BaseData { public isGirlPhotoShowInList(categoryId: string, girlId: number, id: number): boolean { let oneData = this.getGrilDetail(categoryId, girlId); if (!oneData) return false; - // 展示类型 - const showType = oneData.getGrilPhotoType(id); - return showType === 1; + return oneData.isGirlPhotoShowInList(id); } /** 图片展示类型:在聊天触发 */ public isGirlPhotoShowInChat(categoryId: string, girlId: number, id: number): boolean { let oneData = this.getGrilDetail(categoryId, girlId); if (!oneData) return false; - // 展示类型 - const showType = oneData.getGrilPhotoType(id); - return showType === 2; + return oneData.isGirlPhotoShowInChat(id); } /** 图片是否免费 */ diff --git a/assets/Scripts/chat18x/data/GirlDetailData.ts b/assets/Scripts/chat18x/data/GirlDetailData.ts index 17499726..2c5b3d28 100644 --- a/assets/Scripts/chat18x/data/GirlDetailData.ts +++ b/assets/Scripts/chat18x/data/GirlDetailData.ts @@ -108,16 +108,24 @@ export class GirlDetailData extends BaseData { return allId; } + /** 获取所有技师图片数据的id,展示类型属于在详情页展示 */ + public getAllListGrilPhotoId(): number[] { + if (!this.photoData) return []; + // 筛选出类型为 1 的图片 + let listPhotos = this.photoData.filter(photo => photo.imageType === 1); + // 按 id 从小到大排序 + listPhotos.sort((a, b) => a.id - b.id); + // 返回排序后的 id 数组 + return listPhotos.map(photo => photo.id); + } + /** 获取所有技师图片数据的id,展示类型属于在聊天中触发 */ public getAllTriggerGrilPhotoId(): number[] { if (!this.photoData) return []; - // 筛选出类型为 2 的图片 let triggerPhotos = this.photoData.filter(photo => photo.imageType === 2); - // 按 unlockCounts 从大到小排序 triggerPhotos.sort((a, b) => b.unlockCounts - a.unlockCounts); - // 返回排序后的 id 数组 return triggerPhotos.map(photo => photo.id); } @@ -141,6 +149,18 @@ export class GirlDetailData extends BaseData { return oneData.imageType; } + /** 图片展示类型:在详情页展示 */ + public isGirlPhotoShowInList(id: number): boolean { + let type = this.getGrilPhotoType(id); + return type === 1; + } + + /** 图片展示类型:在聊天触发 */ + public isGirlPhotoShowInChat(id: number): boolean { + let type = this.getGrilPhotoType(id); + return type === 2; + } + /** 获取技师图片的聊天触发次数 */ public getGrilPhotoUnlockCounts(id: number): number { let oneData = this.getGrilPhotoData(id);