修改ConfigManager,定义配置数据继承体系
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
/**
|
||||
* 技师的详细配置
|
||||
*/
|
||||
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 和 index 获取图片类型 */
|
||||
public getImageTypeById(id: number, index: number): number | null {
|
||||
let oneData = this.getCommercialImagesById(id);
|
||||
if (!oneData) return null;
|
||||
if (index < 0 || index >= oneData.length) return null;
|
||||
return oneData[index].imageType;
|
||||
}
|
||||
|
||||
/** 根据 id 和 index 获取图片价格 */
|
||||
public getImagePriceById(id: number, index: number): number | null {
|
||||
let oneData = this.getCommercialImagesById(id);
|
||||
if (!oneData) return null;
|
||||
if (index < 0 || index >= oneData.length) return null;
|
||||
return oneData[index].imagePrice;
|
||||
}
|
||||
|
||||
/** 根据 id 和 index 获取图片路径 */
|
||||
public getImagePathById(id: number, index: number): string | null {
|
||||
let oneData = this.getCommercialImagesById(id);
|
||||
if (!oneData) return null;
|
||||
if (index < 0 || index >= oneData.length) return null;
|
||||
return oneData[index].path;
|
||||
}
|
||||
|
||||
/** 根据 id 获取 commercialVideos */
|
||||
private getCommercialVideosById(id: number): any | null {
|
||||
let oneData = this.getConfigById(id);
|
||||
if (!oneData) return null;
|
||||
return oneData.commercialVideos;
|
||||
}
|
||||
|
||||
/** 根据 id 和 index 获取视频路径 */
|
||||
public getVideoPathById(id: number, index: number): string | null {
|
||||
let oneData = this.getCommercialVideosById(id);
|
||||
if (!oneData) return null;
|
||||
if (index < 0 || index >= oneData.length) return null;
|
||||
return oneData[index].path;
|
||||
}
|
||||
|
||||
/** 根据 id 和 index 获取关联情绪 */
|
||||
public getVideoEmotionById(id: number, index: number): number | null {
|
||||
let oneData = this.getCommercialVideosById(id);
|
||||
if (!oneData) return null;
|
||||
if (index < 0 || index >= oneData.length) return null;
|
||||
return oneData[index].emotion;
|
||||
}
|
||||
|
||||
/** 根据 id 和 index 获取视频价格 */
|
||||
public getVideoPriceById(id: number, index: number): number | null {
|
||||
let oneData = this.getCommercialVideosById(id);
|
||||
if (!oneData) return null;
|
||||
if (index < 0 || index >= oneData.length) return null;
|
||||
return oneData[index].videoPrice;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user