后台:拉取物品表

This commit is contained in:
luying
2021-06-07 20:11:17 +08:00
parent 8c35bd1430
commit 326d9548ce
4 changed files with 23 additions and 1 deletions

View File

@@ -20,6 +20,12 @@ export default class GameController extends Controller {
return
}
public async getDicGoods() {
const { ctx } = this;
ctx.body = await ctx.service.game.getDicGoods();
return
}
public async getDicRMB() {
const { ctx } = this;
ctx.body = await ctx.service.game.getDicRmb();

View File

@@ -45,6 +45,7 @@ export default (app: Application) => {
router.post('/api/game/getserverenv', tokenParser, controller.game.getServerEnv);
router.post('/api/game/getserverlistbyenv', controller.game.getServerListByEnv);
router.post('/api/game/getdicgoods', controller.game.getDicGoods);
router.post('/api/game/getdichero', controller.game.getDicHero);
router.post('/api/game/getdicrmb', controller.game.getDicRMB);
router.post('/api/game/getdicactivitytype', controller.game.getDicActivityType);

View File

@@ -54,6 +54,18 @@ export default class Game extends Service {
})
}
public async getDicGoods() {
let list = [];
for(let [_, { good_id, name, pieceId, quality, itid, image_id }] of gameData.goods) {
list.push({
good_id, name, pieceId, quality, itid, image_id
})
}
return this.ctx.service.utils.resResult(STATUS.SUCCESS, {
list
})
}
public async getDicRmb() {
let list: DicRMB[] = [];
for(let [_, dicRmb] of gameData.rmb) {

View File

@@ -62,6 +62,8 @@ export interface DicGoods {
readonly condition: {id: number, type: number, params: number[]}[];
// 时间限制
readonly timeLimit: number;
// 图片
readonly image_id: number;
}
type KeysEnum<T> = { [P in keyof Required<T>]: true };
@@ -91,7 +93,8 @@ const DicGoodsKeys: KeysEnum<DicGoods> = {
nextSpecialId: true,
equipId: true,
condition: true,
timeLimit: true
timeLimit: true,
image_id: true
}
export const dicJewel = new Map<number, DicGoods>();
export const dicGoods = new Map<number, DicGoods>();