后台:json上传
This commit is contained in:
@@ -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}>();
|
||||
|
||||
Reference in New Issue
Block a user