修改ConfigManager,定义配置数据继承体系

This commit is contained in:
chen wei bo
2025-09-01 19:07:24 +08:00
parent c9817ea13e
commit 8eb3f01688
12 changed files with 457 additions and 10 deletions
@@ -0,0 +1,85 @@
/**
* 技师的简要配置
*/
import { BaseConfig } from "./BaseConfig";
import { ConfigManager } from "../manager/ConfigManager";
export class GirlConfig extends BaseConfig {
public reset(): void {
}
public clear(): void {
}
public destroy(): void {
super.destroy();
}
/**
* 获取所有配置
*/
protected getAllConfig(): any | null {
return ConfigManager.tables.TbGirls;
}
/**
* 获取配置,根据 id
*/
protected getConfigById(id: number): any | null {
let allData = this.getAllConfig();
if (!allData) return null;
return allData.get(id);
}
/** 根据 id 获取名字 */
public getNameById(id: number): string | null {
let oneData = this.getConfigById(id);
if (!oneData) return null;
return oneData.nameKey;
}
/** 根据 id 获取年龄 */
public getAgeById(id: number): string | null {
let oneData = this.getConfigById(id);
if (!oneData) return null;
return oneData.age;
}
/** 根据 id 获取分类 */
public getCategoryById(id: number): number | null {
let oneData = this.getConfigById(id);
if (!oneData) return null;
return oneData.category;
}
/** 根据 id 获取标签键 */
public getTagKeyById(id: number): string | null {
let oneData = this.getConfigById(id);
if (!oneData) return null;
return oneData.tagKey;
}
/** 根据 id 获取付费类型 */
public getPriceTypeById(id: number): number | null {
let oneData = this.getConfigById(id);
if (!oneData) return null;
return oneData.priceType;
}
/** 根据 id 获取头像路径 */
public getAvatarPathById(id: number): string | null {
let oneData = this.getConfigById(id);
if (!oneData) return null;
return oneData.avatarPath;
}
/** 根据 id 获取头像路径 */
public getListAvatarPathPathById(id: number): string | null {
let oneData = this.getConfigById(id);
if (!oneData) return null;
return oneData.listAvatarPath;
}
}