后台: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
+16 -15
View File
@@ -1,5 +1,5 @@
// 商店商品表
import { readJsonFile } from '../util'
import { readFileAndParse } from '../util'
import { FILENAME } from '../../consts'
export interface DicShop {
@@ -26,20 +26,21 @@ export interface DicShop {
readonly price: number;
}
const str = readJsonFile(FILENAME.DIC_SHOP);
let arr = JSON.parse(str);
export const dicShopItem = new Map<number, DicShop>(); // itemid => DicShop
export const dicShop = new Map<number, DicShop[]>(); // shop => DicShop[]
export function loadShop() {
arr.forEach(o => {
o.guildLvLimit = o.guildlvlimit == '&'?0: o.guildlvlimit;
o.purchaseLimit = o.purchaselimit == '&'?-1: o.purchaselimit;
if(!dicShop.has(o.shop)) {
dicShop.set(o.shop, [o]);
} else {
dicShop.get(o.shop).push(o);
}
dicShopItem.set(o.id, o);
});
let arr = readFileAndParse(FILENAME.DIC_SHOP);
arr.forEach(o => {
o.guildLvLimit = o.guildlvlimit == '&'?0: o.guildlvlimit;
o.purchaseLimit = o.purchaselimit == '&'?-1: o.purchaselimit;
if(!dicShop.has(o.shop)) {
dicShop.set(o.shop, [o]);
} else {
dicShop.get(o.shop).push(o);
}
dicShopItem.set(o.id, o);
});
arr = undefined;
}