170 lines
5.2 KiB
TypeScript
170 lines
5.2 KiB
TypeScript
/**
|
|
* 技师的详细配置
|
|
*/
|
|
import { BaseConfig } from "./BaseConfig";
|
|
import { ConfigManager } from "../manager/ConfigManager";
|
|
|
|
export class GirlDetailConfig extends BaseConfig {
|
|
|
|
public reset(): void {
|
|
|
|
}
|
|
|
|
public clear(): void {
|
|
|
|
}
|
|
|
|
public destroy(): void {
|
|
super.destroy();
|
|
}
|
|
|
|
/**
|
|
* 获取所有配置
|
|
*/
|
|
protected getAllConfig(): any | null {
|
|
return ConfigManager.tables.TbGirlsDetail;
|
|
}
|
|
|
|
/**
|
|
* 获取配置,根据 id
|
|
*/
|
|
protected getConfigById(id: number): any | null {
|
|
let allData = this.getAllConfig();
|
|
if (!allData) return null;
|
|
return allData.get(id);
|
|
}
|
|
|
|
/** 根据 id 获取详细描述 */
|
|
public getDetailDescById(id: number): string | null {
|
|
let oneData = this.getConfigById(id);
|
|
if (!oneData) return null;
|
|
return oneData.detailDesc;
|
|
}
|
|
|
|
/** 根据 id 获取 commercialImages */
|
|
private getCommercialImagesById(id: number): any | null {
|
|
let oneData = this.getConfigById(id);
|
|
if (!oneData) return null;
|
|
return oneData.commercialImages;
|
|
}
|
|
|
|
/** 根据 id 获取 commercialImages数量 */
|
|
public getCommercialImagesCount(id: number): number | null {
|
|
let oneData = this.getCommercialImagesById(id);
|
|
if (!oneData) return null;
|
|
return oneData.length;
|
|
}
|
|
|
|
/** 根据 id 获取 commercialImages的id数组 */
|
|
public getCommercialImagesIds(id: number): number[] {
|
|
let oneData = this.getCommercialImagesById(id);
|
|
if (!oneData) return [];
|
|
// 获取所有 id
|
|
let allId = [];
|
|
for (let one of oneData) {
|
|
allId.push(one.id);
|
|
}
|
|
return allId;
|
|
}
|
|
|
|
/** 根据 id 获取 某一个commercialImage */
|
|
private getOneCommercialImageById(id: number, resId: number): any | null {
|
|
let oneData = this.getCommercialImagesById(id);
|
|
if (!oneData) return null;
|
|
// 遍历数组找到匹配的资源
|
|
for (let one of oneData) {
|
|
if (one.id === resId) {
|
|
return one;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
/** 根据 id 获取图片类型 */
|
|
public getImageTypeById(id: number, resId: number): number | null {
|
|
let oneData = this.getOneCommercialImageById(id, resId);
|
|
if (!oneData) return null;
|
|
return oneData.imageType;
|
|
}
|
|
|
|
/** 根据 id 获取聊天触发次数 */
|
|
public getImageUnlockCountsById(id: number, resId: number): number | null {
|
|
let oneData = this.getOneCommercialImageById(id, resId);
|
|
if (!oneData) return null;
|
|
return oneData.unlockCounts;
|
|
}
|
|
|
|
/** 根据 id 获取图片价格 */
|
|
public getImagePriceById(id: number, resId: number): number | null {
|
|
let oneData = this.getOneCommercialImageById(id, resId);
|
|
if (!oneData) return null;
|
|
return oneData.imagePrice;
|
|
}
|
|
|
|
/** 根据 id 获取图片路径 */
|
|
public getImagePathById(id: number, resId: number): string | null {
|
|
let oneData = this.getOneCommercialImageById(id, resId);
|
|
if (!oneData) return null;
|
|
return oneData.path;
|
|
}
|
|
|
|
/** 根据 id 获取 commercialVideos */
|
|
private getCommercialVideosById(id: number): any | null {
|
|
let oneData = this.getConfigById(id);
|
|
if (!oneData) return null;
|
|
return oneData.commercialVideos;
|
|
}
|
|
|
|
/** 根据 id 获取 commercialVideos数量 */
|
|
public getCommercialVideosCount(id: number): number | null {
|
|
let oneData = this.getCommercialVideosById(id);
|
|
if (!oneData) return null;
|
|
return oneData.length;
|
|
}
|
|
|
|
/** 根据 id 获取 commercialVideo的id数组 */
|
|
public getCommercialVideosIds(id: number): number[] {
|
|
let oneData = this.getCommercialVideosById(id);
|
|
if (!oneData) return [];
|
|
// 获取所有 id
|
|
let allId = [];
|
|
for (let one of oneData) {
|
|
allId.push(one.id);
|
|
}
|
|
return allId;
|
|
}
|
|
|
|
/** 根据 id 获取 某一个commercialVideo */
|
|
private getOneCommercialVideoById(id: number, resId: number): any | null {
|
|
let oneData = this.getCommercialVideosById(id);
|
|
if (!oneData) return null;
|
|
// 遍历数组找到匹配的资源
|
|
for (let one of oneData) {
|
|
if (one.id === resId) {
|
|
return one;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
/** 根据 id 获取视频路径 */
|
|
public getVideoPathById(id: number, resId: number): string | null {
|
|
let oneData = this.getOneCommercialVideoById(id, resId);
|
|
if (!oneData) return null;
|
|
return oneData.path;
|
|
}
|
|
|
|
/** 根据 id 获取关联情绪 */
|
|
public getVideoEmotionById(id: number, resId: number): number | null {
|
|
let oneData = this.getOneCommercialVideoById(id, resId);
|
|
if (!oneData) return null;
|
|
return oneData.emotion;
|
|
}
|
|
|
|
/** 根据 id 获取视频价格 */
|
|
public getVideoPriceById(id: number, resId: number): number | null {
|
|
let oneData = this.getOneCommercialVideoById(id, resId);
|
|
if (!oneData) return null;
|
|
return oneData.videoPrice;
|
|
}
|
|
} |