协议调试

This commit is contained in:
chen wei bo
2025-09-10 01:00:48 +08:00
parent eb55de718e
commit 6c1f564f03
5 changed files with 150 additions and 38 deletions
+123 -17
View File
@@ -317,7 +317,10 @@ export class GirlData extends BaseData {
return oneData.getAllGrilPhotoId();
}
/** 获取所有用来展示在列表的技师图片的id */
/** 获取所有用来展示在列表的技师图片的id,可展示的有以下几种情况
* 1,图片类型为在详情页展示的(不管免费,付费,是否解锁)
* 2,图片类型为在聊天触发的,并且已经达到了触发次数的(不管是否已经解锁)
*/
public getAllDisplayGrilPhotoId(
categoryId: string,
girlId: number
@@ -331,28 +334,58 @@ export class GirlData extends BaseData {
// 用来展示的id
let displayIds = [];
for (let id of allId) {
let unlockCounts = oneData.getGrilPhotoUnlockCounts(id);
let price = oneData.getGrilPhotoPrice(id);
if (price <= 0) {
// 价格为0,代表免
displayIds.push(id);
} else {
// 价格大于0,代表付费
let isUnlock = this.isImageUnlock(categoryId, girlId, id);
if (isUnlock) {
// 已经解锁
const unlockCounts = oneData.getGrilPhotoUnlockCounts(id);
// 免费
const isFreeType = this.isGirlPhotoFreeType(categoryId, girlId, id);
//
const isPayType = this.isGirlPhotoPayType(categoryId, girlId, id);
// 在详情页展示
const isShowInList = this.isGirlPhotoShowInList(categoryId, girlId, id);
// 在聊天触发
const isShowInChat = this.isGirlPhotoShowInChat(categoryId, girlId, id);
if (isShowInList) {
displayIds.push(id);
} else if (isShowInChat) {
// 总聊天次数 大于等于 触发次数
if (chatTotalCount >= unlockCounts) {
displayIds.push(id);
} else {
// 总聊天次数 大于等于 触发次数
if (chatTotalCount >= unlockCounts) {
displayIds.push(id);
}
}
}
}
return displayIds;
}
/** 用来展示在列表的技师图片是否可见 */
public isGirlPhotoVisible(categoryId: string, girlId: number, id: number): boolean {
// 免费
const isFreeType = this.isGirlPhotoFreeType(categoryId, girlId, id);
// 付费
const isPayType = this.isGirlPhotoPayType(categoryId, girlId, id);
// 在详情页展示
const isShowInList = this.isGirlPhotoShowInList(categoryId, girlId, id);
// 在聊天触发
const isShowInChat = this.isGirlPhotoShowInChat(categoryId, girlId, id);
if (isShowInList) {
if (isFreeType) {
// 免费,可见
return true;
} else if (isPayType) {
// 付费,并且已经解锁,可见
const isUnlock = this.isImageUnlock(categoryId, girlId, id);
if (isUnlock) return true;
}
} else if (isShowInChat) {
// 总聊天次数 大于等于 触发次数
const isUnlock = this.isImageUnlock(categoryId, girlId, id);
// 已经解锁,可见
if (isUnlock) return true;
}
// 其他情况,不可见
return false;
}
/** 获取第一个技师图片的资源路径 */
public getFirstGrilPhotoPath(categoryId: string, girlId: number): string {
let oneData = this.getGrilDetail(categoryId, girlId);
@@ -365,6 +398,42 @@ export class GirlData extends BaseData {
return oneData.getGrilPhotoPath(ids[0]);
}
/** 图片展示类型:在详情页展示 */
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;
}
/** 图片展示类型:在聊天触发 */
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;
}
/** 图片是否免费 */
public isGirlPhotoFreeType(categoryId: string, girlId: number, id: number): boolean {
let oneData = this.getGrilDetail(categoryId, girlId);
if (!oneData) return false;
// 价格
const price = oneData.getGrilPhotoPrice(id);
return price <= 0;
}
/** 图片是否需要付费 */
public isGirlPhotoPayType(categoryId: string, girlId: number, id: number): boolean {
let oneData = this.getGrilDetail(categoryId, girlId);
if (!oneData) return true;
// 价格
const price = oneData.getGrilPhotoPrice(id);
return price > 0;
}
/** 获取技师图片的类型 */
public getGrilPhotoType(
categoryId: string,
@@ -399,7 +468,7 @@ export class GirlData extends BaseData {
let price = oneData.getGrilPhotoPrice(id);
return price / 100;
}
/** 获取技师图片的价格 */
public getGrilPhotoPrice(
categoryId: string,
@@ -444,6 +513,43 @@ export class GirlData extends BaseData {
return this.getAllGrilVideoId(categoryId, girlId);
}
/** 用来展示在列表的技师视频是否可见 */
public isGirlVideoVisible(categoryId: string, girlId: number, id: number): boolean {
// 免费
const isFreeType = this.isGirlVideoFreeType(categoryId, girlId, id);
// 付费
const isPayType = this.isGirlVideoPayType(categoryId, girlId, id);
if (isFreeType) {
// 免费,可见
return true;
} else if (isPayType) {
// 付费,并且已经解锁,可见
const isUnlock = this.isVideoUnlock(categoryId, girlId, id);
if (isUnlock) return true;
}
// 其他情况,不可见
return false;
}
/** 视频是否免费 */
public isGirlVideoFreeType(categoryId: string, girlId: number, id: number): boolean {
let oneData = this.getGrilDetail(categoryId, girlId);
if (!oneData) return false;
// 价格
const price = oneData.getGrilVideoPrice(id);
return price <= 0;
}
/** 视频是否需要付费 */
public isGirlVideoPayType(categoryId: string, girlId: number, id: number): boolean {
let oneData = this.getGrilDetail(categoryId, girlId);
if (!oneData) return true;
// 价格
const price = oneData.getGrilVideoPrice(id);
return price > 0;
}
/** 获取第一个技师视频的资源路径 */
public getFirstGrilVideoPath(categoryId: string, girlId: number): string {
let oneData = this.getGrilDetail(categoryId, girlId);