28 lines
681 B
TypeScript
28 lines
681 B
TypeScript
import { readFileAndParse } from '../util'
|
|
import { FILENAME } from '../../consts'
|
|
|
|
export interface DicApi {
|
|
// id
|
|
readonly id: number;
|
|
// 消耗
|
|
readonly api: string;
|
|
// 描述
|
|
readonly name: string;
|
|
// 模块
|
|
readonly module: string;
|
|
// 类型 增删改查
|
|
readonly type: string;
|
|
}
|
|
|
|
export const dicApiByUrl = new Map<string, DicApi>();
|
|
export const dicApiById = new Map<number, DicApi>();
|
|
export function loadApi() {
|
|
dicApiByUrl.clear();
|
|
dicApiById.clear();
|
|
let arr = readFileAndParse(FILENAME.DIC_API);
|
|
arr.forEach(o => {
|
|
dicApiByUrl.set(o.api, o);
|
|
dicApiById.set(o.id, o);
|
|
});
|
|
arr = undefined;
|
|
} |