后台:添加查询taskType
This commit is contained in:
@@ -31,4 +31,10 @@ export default class GameController extends Controller {
|
||||
ctx.body = await ctx.service.game.getDicActivityType();
|
||||
return
|
||||
}
|
||||
|
||||
public async getDicTaskType() {
|
||||
const { ctx } = this;
|
||||
ctx.body = await ctx.service.game.getDicTaskType();
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ export default (app: Application) => {
|
||||
router.post('/api/game/getdichero', controller.game.getDicHero);
|
||||
router.post('/api/game/getdicrmb', controller.game.getDicRMB);
|
||||
router.post('/api/game/getdicactivitytype', controller.game.getDicActivityType);
|
||||
router.post('/api/game/getdictasktype', controller.game.getDicTaskType);
|
||||
|
||||
router.post('/api/activity/getactivitylist', controller.activity.getActivityList);
|
||||
router.post('/api/activity/updateactivity', controller.activity.updateActivity);
|
||||
|
||||
@@ -6,6 +6,7 @@ import { gameData } from '@pubUtils/data';
|
||||
import { DicHero } from '@pubUtils/dictionary/DicHero';
|
||||
import { DicRMB } from '@pubUtils/dictionary/DicRMB';
|
||||
import { DicActivityType } from '@pubUtils/dictionary/DicActivityType';
|
||||
import { DicTaskType } from '@pubUtils/dictionary/DicTaskType';
|
||||
|
||||
/**
|
||||
* Test Service
|
||||
@@ -69,4 +70,11 @@ export default class Game extends Service {
|
||||
list
|
||||
})
|
||||
}
|
||||
|
||||
public async getDicTaskType() {
|
||||
let list: DicTaskType[] = gameData.taskTypeDesc;
|
||||
return this.ctx.service.utils.resResult(STATUS.SUCCESS, {
|
||||
list
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -437,7 +437,8 @@ export const FILENAME = {
|
||||
DIC_GIFT_PACKAGE: 'dic_zyz_giftPackage',
|
||||
DIC_RECRUIT: 'dic_zyz_recruit',
|
||||
DIC_RMB: 'dic_zyz_rmb',
|
||||
DIC_ACTIVITY_TYPE: 'dic_zyz_activityType'
|
||||
DIC_ACTIVITY_TYPE: 'dic_zyz_activityType',
|
||||
DIC_TASK_TYPE: 'dic_zyz_taskType'
|
||||
}
|
||||
|
||||
export const WAR_RELATE_TABLES = [
|
||||
|
||||
@@ -83,6 +83,7 @@ import { dicGiftPackage, loadGiftPackage } from "./dictionary/DicGiftPackage";
|
||||
import { dicRecruit, loadRecruit } from './dictionary/DicRecruit';
|
||||
import { loadRMB, dicRMB } from './dictionary/DicRMB';
|
||||
import { dicActivityType, loadActivityType } from './dictionary/DicActivityType';
|
||||
import { dicTaskTypeDesc, loadTaskType } from './dictionary/DicTaskType';
|
||||
|
||||
export const gameData = {
|
||||
blurprtCompose: dicBlueprtCompose,
|
||||
@@ -202,7 +203,8 @@ export const gameData = {
|
||||
comBtlLvRange: new Map<number, Array<number>>(),
|
||||
recruit: dicRecruit,
|
||||
rmb: dicRMB,
|
||||
activityType: dicActivityType
|
||||
activityType: dicActivityType,
|
||||
taskTypeDesc: dicTaskTypeDesc
|
||||
};
|
||||
|
||||
// 在此提供一些原先在gamedata中提供的方法,以便更方便获取gameData数据
|
||||
@@ -762,6 +764,7 @@ function loadDatas() {
|
||||
loadRecruit();
|
||||
loadRMB();
|
||||
loadActivityType();
|
||||
loadTaskType();
|
||||
}
|
||||
|
||||
// 重载dicParam
|
||||
|
||||
34
shared/pubUtils/dictionary/DicTaskType.ts
Normal file
34
shared/pubUtils/dictionary/DicTaskType.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME, TASK_TYPE } from '../../consts'
|
||||
type KeysEnum<T> = { [P in keyof Required<T>]: true };
|
||||
const _ = require('lodash');
|
||||
|
||||
export interface DicTaskType {
|
||||
readonly id: TASK_TYPE;
|
||||
// 分类
|
||||
readonly name: string;
|
||||
// 描述
|
||||
readonly info: string;
|
||||
// taskParam怎么填
|
||||
readonly param: string;
|
||||
// condition怎么填
|
||||
readonly condition: string;
|
||||
}
|
||||
|
||||
const DicTaskTypeKeys: KeysEnum<DicTaskType> = {
|
||||
id: true,
|
||||
name: true,
|
||||
info: true,
|
||||
param: true,
|
||||
condition: true
|
||||
};
|
||||
|
||||
export const dicTaskTypeDesc = new Array<DicTaskType>();
|
||||
export function loadTaskType() {
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_TASK_TYPE);
|
||||
arr.forEach(o => {
|
||||
dicTaskTypeDesc.push(_.pick(o, Object.keys(DicTaskTypeKeys)));
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
Reference in New Issue
Block a user