后台:json上传

This commit is contained in:
luying
2021-05-12 18:56:47 +08:00
parent 2fc5017af8
commit 148a11edab
102 changed files with 1675 additions and 1117 deletions
+11 -9
View File
@@ -1,5 +1,5 @@
// 时装表
import { decodeArrayListStr, readJsonFile } from '../util';
import { decodeArrayListStr, readFileAndParse } from '../util';
import { FILENAME } from '../../consts';
export interface DicFashions {
@@ -15,15 +15,17 @@ export interface DicFashions {
readonly actorId: number;
}
const str = readJsonFile(FILENAME.DIC_FASHIONS);
let arr = JSON.parse(str);
export const dicFashions = new Map<number, DicFashions>();
arr.forEach(o => {
o.globalAttr = parseAttr(o.globalAttr);
o.actorAttr = parseAttr(o.actorAttr);
dicFashions.set(o.id, o);
});
export function loadFashions() {
let arr = readFileAndParse(FILENAME.DIC_FASHIONS);
arr.forEach(o => {
o.globalAttr = parseAttr(o.globalAttr);
o.actorAttr = parseAttr(o.actorAttr);
dicFashions.set(o.id, o);
});
arr = undefined;
}
function parseAttr(str: string) {
let result = new Array<{id: number, number: number}>();