后台:json上传

This commit is contained in:
luying
2021-05-12 17:57:25 +08:00
parent 2fc5017af8
commit 148a11edab
102 changed files with 1675 additions and 1117 deletions

View File

@@ -1,5 +1,5 @@
// 主线任务阶段内容
import {readJsonFile, parseGoodStr} from '../util'
import {readFileAndParse, parseGoodStr} from '../util'
import { FILENAME, TASK_FUN_TYPE } from '../../consts'
import { RewardInter } from '../interface';
@@ -13,25 +13,25 @@ export interface DicTaskBox {
}
export const dicTaskBox = new Map<number, Map<number, DicTaskBox>>();
export function loadTaskBox() {
const str1 = readJsonFile(FILENAME.DIC_TASK_BOX);
let arr1 = JSON.parse(str1);
arr1.forEach(o => {
if(!dicTaskBox.has(TASK_FUN_TYPE.DAILY)) {
dicTaskBox.set(TASK_FUN_TYPE.DAILY, new Map<number, DicTaskBox>());
}
o.reward = parseGoodStr(o.reward);
dicTaskBox.get(TASK_FUN_TYPE.DAILY).set(o.id, o);
});
arr1 = undefined;
const str2 = readJsonFile(FILENAME.DIC_ACHIEVEMENT_BOX);
let arr2 = JSON.parse(str2);
arr2.forEach(o => {
if(!dicTaskBox.has(TASK_FUN_TYPE.ACHIEVEMENT)) {
dicTaskBox.set(TASK_FUN_TYPE.ACHIEVEMENT, new Map<number, DicTaskBox>());
}
o.reward = parseGoodStr(o.reward);
dicTaskBox.get(TASK_FUN_TYPE.ACHIEVEMENT).set(o.id, o);
});
arr2 = undefined;
let arr1 = readFileAndParse(FILENAME.DIC_TASK_BOX);
arr1.forEach(o => {
if(!dicTaskBox.has(TASK_FUN_TYPE.DAILY)) {
dicTaskBox.set(TASK_FUN_TYPE.DAILY, new Map<number, DicTaskBox>());
}
o.reward = parseGoodStr(o.reward);
dicTaskBox.get(TASK_FUN_TYPE.DAILY).set(o.id, o);
});
arr1 = undefined;
let arr2 = readFileAndParse(FILENAME.DIC_ACHIEVEMENT_BOX);
arr2.forEach(o => {
if(!dicTaskBox.has(TASK_FUN_TYPE.ACHIEVEMENT)) {
dicTaskBox.set(TASK_FUN_TYPE.ACHIEVEMENT, new Map<number, DicTaskBox>());
}
o.reward = parseGoodStr(o.reward);
dicTaskBox.get(TASK_FUN_TYPE.ACHIEVEMENT).set(o.id, o);
});
arr2 = undefined;
}