模拟数据:技师的详细数据
This commit is contained in:
@@ -88,14 +88,16 @@ export class GirlData extends BaseData {
|
||||
private parseOneGirlBrief(data: proto.cs.IGirlBrief): proto.cs.IGirlBrief | null {
|
||||
if (!data) return null;
|
||||
const oneData: proto.cs.IGirlBrief = {
|
||||
id: data.id, // id
|
||||
name: data.name, // 名字
|
||||
age: data.age, // 年龄
|
||||
tagKey: data.tagKey, // 标签
|
||||
priceType: data.priceType, // 付费类型
|
||||
price: data.price, // 价格
|
||||
avatar: data.avatar, // 头像
|
||||
star: data.star, // 星级
|
||||
id: data.id, // id
|
||||
name: data.name, // 名字
|
||||
age: data.age, // 年龄
|
||||
tagKey: data.tagKey, // 标签
|
||||
priceType: data.priceType, // 付费类型
|
||||
price: data.price, // 价格
|
||||
avatar: data.avatar, // 头像
|
||||
star: data.star, // 星级
|
||||
category: data.category, // 主题枚举
|
||||
listAvatarPath: data.listAvatarPath, // list头像路径
|
||||
};
|
||||
return oneData;
|
||||
}
|
||||
@@ -174,25 +176,40 @@ export class GirlData extends BaseData {
|
||||
return oneData.star;
|
||||
}
|
||||
|
||||
/** 获取主题枚举 */
|
||||
public getGrilCategory(categoryId: string, girlId: number): number {
|
||||
let oneData = this.getGrilBrief(categoryId, girlId);
|
||||
if (!oneData) return 0;
|
||||
return oneData.category;
|
||||
}
|
||||
|
||||
/** 获取list头像路径 */
|
||||
public getGrilListAvatar(categoryId: string, girlId: number): string {
|
||||
let oneData = this.getGrilBrief(categoryId, girlId);
|
||||
if (!oneData) return "";
|
||||
return oneData.listAvatarPath;
|
||||
}
|
||||
|
||||
/** --------------------------------------------------------- 技师的详细数据 --------------------------------------------------------- */
|
||||
|
||||
// 解析技师图片数据,一个
|
||||
private parseOneGirlPhoto(data: proto.cs.IGirlPhoto): proto.cs.IGirlPhoto | null {
|
||||
private parseOneGirlPhoto(data: proto.cs.IPurchaseCommercialImage): proto.cs.IPurchaseCommercialImage | null {
|
||||
if (!data) return null;
|
||||
const oneData: proto.cs.IGirlPhoto = {
|
||||
pic: data.pic, // 图片路径
|
||||
const oneData: proto.cs.IPurchaseCommercialImage = {
|
||||
imageType: data.imageType, // 图片类型
|
||||
imagePrice: data.imagePrice, // 图片价格
|
||||
path: data.path, // 图片资源路径
|
||||
isRelease: data.isRelease, // 是否解锁
|
||||
price: data.price, // 价格
|
||||
};
|
||||
return oneData;
|
||||
}
|
||||
|
||||
// 解析技师图片数据,多个
|
||||
private parseAllGirlPhoto(data: proto.cs.IGirlPhoto[]): proto.cs.IGirlPhoto[] | null {
|
||||
private parseAllGirlPhoto(data: proto.cs.IPurchaseCommercialImage[]): proto.cs.IPurchaseCommercialImage[] | null {
|
||||
if (!data) return null;
|
||||
let allData = [];
|
||||
for (const value of data) {
|
||||
const oneData: proto.cs.IGirlPhoto = this.parseOneGirlPhoto(value);
|
||||
const oneData: proto.cs.IPurchaseCommercialImage = this.parseOneGirlPhoto(value);
|
||||
if (oneData) {
|
||||
allData.push(oneData);
|
||||
}
|
||||
@@ -200,17 +217,44 @@ export class GirlData extends BaseData {
|
||||
return allData;
|
||||
}
|
||||
|
||||
// 解析技师视频数据,一个
|
||||
private parseOneGirlVideo(data: proto.cs.IPurchaseCommercialVideo): proto.cs.IPurchaseCommercialVideo | null {
|
||||
if (!data) return null;
|
||||
const oneData: proto.cs.IPurchaseCommercialVideo = {
|
||||
path: data.path, // 视频资源路径
|
||||
emotion: data.emotion, // 关联情绪
|
||||
videoPrice: data.videoPrice, // 价格
|
||||
isRelease: data.isRelease, // 是否解锁
|
||||
};
|
||||
return oneData;
|
||||
}
|
||||
|
||||
// 解析技师视频数据,多个
|
||||
private parseAllGirlVideo(data: proto.cs.IPurchaseCommercialVideo[]): proto.cs.IPurchaseCommercialVideo[] | null {
|
||||
if (!data) return null;
|
||||
let allData = [];
|
||||
for (const value of data) {
|
||||
const oneData: proto.cs.IPurchaseCommercialVideo = this.parseOneGirlVideo(value);
|
||||
if (oneData) {
|
||||
allData.push(oneData);
|
||||
}
|
||||
}
|
||||
return allData;
|
||||
}
|
||||
|
||||
// 解析技师详细数据,一个
|
||||
private parseOneGirlDetail(data: proto.cs.IGirlDetail): proto.cs.IGirlDetail | null {
|
||||
if (!data) return null;
|
||||
const photoData = this.parseAllGirlPhoto(data.photos);
|
||||
const photoData = this.parseAllGirlPhoto(data.images);
|
||||
const videoData = this.parseAllGirlVideo(data.videos);
|
||||
const briefData = this.parseOneGirlBrief(data.brief);
|
||||
const oneData: proto.cs.IGirlDetail = {
|
||||
brief: briefData, // 技师简要数据
|
||||
desc: data.desc, // 技师描述
|
||||
photos: photoData, // 技师图片列表
|
||||
desc: data.desc, // 技师描述
|
||||
isRelease: data.isRelease, // 技师是否解锁
|
||||
chatCount: data.chatCount, // 剩余聊天次数
|
||||
images: photoData, // 技师图片列表
|
||||
videos: videoData, // 技师视频列表
|
||||
};
|
||||
return oneData;
|
||||
}
|
||||
@@ -271,21 +315,49 @@ export class GirlData extends BaseData {
|
||||
return oneData.chatCount;
|
||||
}
|
||||
|
||||
/** 获取技师图片数据,通过 index */
|
||||
public getGrilPhotoData(categoryId: string, girlId: number, index: number): proto.cs.IGirlPhoto | null {
|
||||
/** 获取所有技师图片数据 */
|
||||
private getAllGrilPhotoData(categoryId: string, girlId: number): proto.cs.IPurchaseCommercialImage[] | null {
|
||||
let oneData = this.getGrilDetail(categoryId, girlId);
|
||||
if (!oneData || !oneData.photos) return null;
|
||||
// 下标越界保护
|
||||
if (index < 0 || index >= oneData.photos.length) return null;
|
||||
|
||||
return oneData.photos[index] ?? null;
|
||||
if (!oneData || !oneData.images) return null;
|
||||
return oneData.images;
|
||||
}
|
||||
|
||||
/** 获取所有技师图片数据的数量 */
|
||||
public getAllGrilPhotoDataCount(categoryId: string, girlId: number): number {
|
||||
let allData = this.getAllGrilPhotoData(categoryId, girlId);
|
||||
if (!allData) return 0;
|
||||
return allData.length;
|
||||
}
|
||||
|
||||
/** 获取技师图片数据,通过 index */
|
||||
private getGrilPhotoData(categoryId: string, girlId: number, index: number): proto.cs.IPurchaseCommercialImage | null {
|
||||
let allData = this.getAllGrilPhotoData(categoryId, girlId);
|
||||
if (!allData) return null;
|
||||
// 下标越界保护
|
||||
if (index < 0 || index >= allData.length) return null;
|
||||
|
||||
return allData[index] ?? null;
|
||||
}
|
||||
|
||||
/** 获取技师图片的类型 */
|
||||
public getGrilPhotoType(categoryId: string, girlId: number, index: number): number {
|
||||
let oneData = this.getGrilPhotoData(categoryId, girlId, index);
|
||||
if (!oneData) return 0;
|
||||
return oneData.imageType;
|
||||
}
|
||||
|
||||
/** 获取技师图片的价格 */
|
||||
public getGrilPhotoPrice(categoryId: string, girlId: number, index: number): number {
|
||||
let oneData = this.getGrilPhotoData(categoryId, girlId, index);
|
||||
if (!oneData) return 0;
|
||||
return oneData.imagePrice;
|
||||
}
|
||||
|
||||
/** 获取技师图片的路径 */
|
||||
public getGrilPhotoPic(categoryId: string, girlId: number, index: number): string {
|
||||
let oneData = this.getGrilPhotoData(categoryId, girlId, index);
|
||||
if (!oneData) return "";
|
||||
return oneData.pic;
|
||||
return oneData.path;
|
||||
}
|
||||
|
||||
/** 获取技师图片是否解锁 */
|
||||
@@ -295,11 +367,57 @@ export class GirlData extends BaseData {
|
||||
return oneData.isRelease;
|
||||
}
|
||||
|
||||
/** 获取技师图片的价格 */
|
||||
public getGrilPhotoPrice(categoryId: string, girlId: number, index: number): number {
|
||||
let oneData = this.getGrilPhotoData(categoryId, girlId, index);
|
||||
/** 获取所有技师视频数据 */
|
||||
private getAllGrilVideoData(categoryId: string, girlId: number): proto.cs.IPurchaseCommercialVideo[] | null {
|
||||
let oneData = this.getGrilDetail(categoryId, girlId);
|
||||
if (!oneData || !oneData.videos) return null;
|
||||
|
||||
return oneData.videos ?? null;
|
||||
}
|
||||
|
||||
/** 获取所有技师视频数据的数量 */
|
||||
public getAllGrilVideoDataCount(categoryId: string, girlId: number): number {
|
||||
let allData = this.getAllGrilVideoData(categoryId, girlId);
|
||||
if (!allData) return 0;
|
||||
return allData.length;
|
||||
}
|
||||
|
||||
/** 获取技师视频数据,通过 index */
|
||||
private getGrilVideoData(categoryId: string, girlId: number, index: number): proto.cs.IPurchaseCommercialVideo | null {
|
||||
let allData = this.getAllGrilVideoData(categoryId, girlId);
|
||||
if (!allData) return null;
|
||||
// 下标越界保护
|
||||
if (index < 0 || index >= allData.length) return null;
|
||||
|
||||
return allData[index] ?? null;
|
||||
}
|
||||
|
||||
/** 获取技师视频的路径 */
|
||||
public getGrilVideoPath(categoryId: string, girlId: number, index: number): string {
|
||||
let oneData = this.getGrilVideoData(categoryId, girlId, index);
|
||||
if (!oneData) return "";
|
||||
return oneData.path;
|
||||
}
|
||||
|
||||
/** 获取技师视频的关联情绪 */
|
||||
public getGrilVideoEmotion(categoryId: string, girlId: number, index: number): number {
|
||||
let oneData = this.getGrilVideoData(categoryId, girlId, index);
|
||||
if (!oneData) return 0;
|
||||
return oneData.price;
|
||||
return oneData.emotion;
|
||||
}
|
||||
|
||||
/** 获取技师视频的价格 */
|
||||
public getGrilVideoPrice(categoryId: string, girlId: number, index: number): number {
|
||||
let oneData = this.getGrilVideoData(categoryId, girlId, index);
|
||||
if (!oneData) return 0;
|
||||
return oneData.videoPrice;
|
||||
}
|
||||
|
||||
/** 获取技师视频是否解锁 */
|
||||
public getGrilVideoIsRelease(categoryId: string, girlId: number, index: number): boolean {
|
||||
let oneData = this.getGrilVideoData(categoryId, girlId, index);
|
||||
if (!oneData) return false;
|
||||
return oneData.isRelease;
|
||||
}
|
||||
|
||||
/** --------------------------------------------------------- 每日推荐 --------------------------------------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user