修改ConfigManager,定义配置数据继承体系
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* 主题配置
|
||||
*/
|
||||
import { BaseConfig } from "./BaseConfig";
|
||||
import { ConfigManager } from "../manager/ConfigManager";
|
||||
|
||||
export class ThemeConfig extends BaseConfig {
|
||||
|
||||
public reset(): void {
|
||||
|
||||
}
|
||||
|
||||
public clear(): void {
|
||||
|
||||
}
|
||||
|
||||
public destroy(): void {
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有配置
|
||||
*/
|
||||
protected getAllConfig(): any | null {
|
||||
return ConfigManager.tables.TbThemes;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配置,根据 id
|
||||
*/
|
||||
protected getConfigById(id: number): any | null {
|
||||
let allData = this.getAllConfig();
|
||||
if (!allData) return null;
|
||||
return allData.get(id);
|
||||
}
|
||||
|
||||
/** 根据主题 id 获取多语言键 */
|
||||
public getLanKeyById(id: number): string | null {
|
||||
let oneData = this.getConfigById(id);
|
||||
if (!oneData) return null;
|
||||
return oneData.key;
|
||||
}
|
||||
|
||||
/** 根据主题 id 获取主题名称 */
|
||||
public getNameById(id: number): string | null {
|
||||
let oneData = this.getConfigById(id);
|
||||
if (!oneData) return null;
|
||||
return oneData.name;
|
||||
}
|
||||
|
||||
/** 根据主题 id 获取主题枚举 */
|
||||
public getCategoryById(id: number): number | null {
|
||||
let oneData = this.getConfigById(id);
|
||||
if (!oneData) return null;
|
||||
return oneData.category;
|
||||
}
|
||||
|
||||
/** 根据主题 id 获取是否解锁 */
|
||||
public getIsReleaseById(id: number): boolean | null {
|
||||
let oneData = this.getConfigById(id);
|
||||
if (!oneData) return null;
|
||||
return oneData.isRelease;
|
||||
}
|
||||
|
||||
/** 根据主题 id 获取图片路径 */
|
||||
public getPathById(id: number): string | null {
|
||||
let oneData = this.getConfigById(id);
|
||||
if (!oneData) return null;
|
||||
return oneData.path;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user