feat(兼容): 配表使用后台隐藏物品

This commit is contained in:
luying
2022-11-09 18:01:02 +08:00
parent 5d0873630a
commit 53d4af4e09
54 changed files with 768 additions and 102 deletions

View File

@@ -201,4 +201,18 @@ export default class GameController extends Controller {
ctx.body = await ctx.service.game.getPvpConfig(page, pageSize, sortField, sortOrder);
return
}
public async getHiddenData() {
const { ctx } = this;
const { page, pageSize, sortField, sortOrder, form } = ctx.request.body;
ctx.body = await ctx.service.game.getHiddenData(page, pageSize, sortField, sortOrder, form);
return
}
public async getExistHiddenData() {
const { ctx } = this;
const { type } = ctx.request.body;
ctx.body = await ctx.service.game.getExistHiddenData(type);
return
}
}

View File

@@ -57,6 +57,8 @@ export default (app: Application) => {
router.post('/api/game/getsurveylist', tokenParser, controller.game.getSurveylist);
router.post('/api/game/getchannelinfo', controller.game.getChannelInfo);
router.post('/api/game/updatechannel', controller.game.updateChannel);
router.post('/api/game/gethiddendata', controller.game.getHiddenData);
router.post('/api/game/getexisthiddendata', controller.game.getExistHiddenData);
router.post('/api/dic/getdicgoods', tokenParser, controller.game.getDicGoods);
router.post('/api/dic/getdichero', tokenParser, controller.game.getDicHero);

View File

@@ -22,6 +22,7 @@ import { SurveyModel } from '@db/Survery';
import { RedisClient } from 'redis';
import { ChannelInfoModel } from '@db/ChannelInfo';
import { PVPConfigModel } from '@db/PvpConfig';
import { HiddenDataByIdModel } from '@db/HiddenDataById';
/**
* Test Service
@@ -324,4 +325,26 @@ export default class Game extends Service {
list, total
});
}
public async getHiddenData(page: number, pageSize: number, sortField: string, sortOrder: string, form: any) {
const { ctx } = this;
const list = await HiddenDataByIdModel.findByCondition(page, pageSize, sortField, sortOrder, form);
const total = await HiddenDataByIdModel.countByCondition(form);
return ctx.service.utils.resResult(STATUS.SUCCESS, {
list: list.map(cur => {
return { ...cur, env: this.app.config.realEnv }
}), total
});
}
public async getExistHiddenData(type: number) {
const { ctx } = this;
let datas = await HiddenDataByIdModel.findExistData(type);
let existIds = datas.map(cur => cur.id);
return ctx.service.utils.resResult(STATUS.SUCCESS, {
ids: existIds
});
}
}