/** * 商城配置 */ import { BaseConfig } from "./BaseConfig"; import { ConfigManager } from "../manager/ConfigManager"; export class PurchaseConfig extends BaseConfig { public reset(): void { } public clear(): void { } public destroy(): void { super.destroy(); } /** * 获取所有配置 */ protected getAllConfig(): any | null { return ConfigManager.tables.TbPurchaseConfig; } /** * 获取配置,根据 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.name; } /** 根据商品 id 获取商品数量 */ public getCountById(id: number): number | null { let oneData = this.getConfigById(id); if (!oneData) return null; return oneData.count; } }