后台: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 -8
View File
@@ -1,5 +1,5 @@
// 礼包奖励表
import { decodeArrayListStr, readJsonFile } from '../util';
import { decodeArrayListStr, readFileAndParse } from '../util';
import { FILENAME } from '../../consts';
import { RewardParam } from '../../domain/activityField/rewardField';
@@ -17,14 +17,17 @@ export interface DicGiftPackage {
}
const str = readJsonFile(FILENAME.DIC_GIFT_PACKAGE);
let arr = JSON.parse(str);
export const dicGiftPackage = new Map<number, DicGiftPackage>();
arr.forEach(o => {
o.reward = parseAttr(o.reward);
dicGiftPackage.set(o.id, o);
});
export function loadGiftPackage() {
let arr = readFileAndParse(FILENAME.DIC_GIFT_PACKAGE);
arr.forEach(o => {
o.reward = parseAttr(o.reward);
dicGiftPackage.set(o.id, o);
});
arr = undefined;
}
function parseAttr(str: string) {
let result = new Array<{ type: number, id: number, count: number }>();