商店:一般购物流程

This commit is contained in:
luying
2021-03-31 17:52:34 +08:00
parent e487d07bfd
commit 8c8adacfdc
21 changed files with 1631 additions and 327 deletions

View File

@@ -0,0 +1,45 @@
// 商店商品表
import { readJsonFile } from '../util'
import { FILENAME } from '../../consts'
export interface DicShop {
// 商品id
readonly id: number;
// 物品表id
readonly goodid: number;
// 物品表名
readonly goodname: number;
// 商店id 对应 dic_zyz_shoplist的id
readonly shop: number;
// 商店标签 对应 dic_zyz_shopType的id
readonly type: number;
// 军团等级需求
readonly guildLvLimit: number;
// 购买次数限制
readonly purchaseLimit: number;
// 刷新类型 1-每日 2-每周 3-每月
readonly refreshType: number;
// 用于购买的货币
readonly money: number;
// 价格
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[]
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);
});

View File

@@ -0,0 +1,26 @@
// 商店表
import { readJsonFile, parseNumberList } from '../util'
import { FILENAME } from '../../consts'
export interface DicShopList {
// 商店id
readonly shopid: number;
// 商店名
readonly shopname: number;
// 商店内标签,小分类
readonly type: number[];
// 使用的货币
readonly money: number[];
}
const str = readJsonFile(FILENAME.DIC_SHOP_LIST);
let arr = JSON.parse(str);
export const dicShopList = new Map<number, DicShopList>();
arr.forEach(o => {
o.type = parseNumberList(o.typeid);
o.money = parseNumberList(o.moneyid);
dicShopList.set(o.shopid, o);
});