import { singleton } from '../decorators/singleton' import { PuzzleCategory } from '../models/content/PuzzleCategory' /** * 用于缓存所有题目的分类 */ @singleton export class QCategoryCache { private _cache:Map = new Map() public async init() { this._cache = await PuzzleCategory.allCateMap() } /** * 根据id获取分类名 * @param {string} id * @return {string} */ public getType(id: string): string { return this._cache.has(id)? this._cache.get(id) : '' } }