Merge branch 'statusCode' of gitlab.trgame.cn:zyztech/zyz_server

Conflicts:
	game-server/app/servers/battle/handler/eventBattleHandler.ts
This commit is contained in:
luying
2020-10-17 10:18:52 +08:00
17 changed files with 232 additions and 298 deletions

View File

@@ -33,37 +33,37 @@ const moment = require('moment');
switch (type) {
case 'fixReward': {
let [gid, count] = arr;
if(isNaN(gid) || isNaN(count)) throw new Error('格式错误');
if(isNaN(gid) || isNaN(count)) throw new Error('data table format wrong');
result = { gid: parseInt(gid), count: parseInt(count)};
break;
}
case 'conditionReward': {
let [gid, count, condition] = arr;
if(isNaN(gid) || isNaN(count)) throw new Error('格式错误');
if(isNaN(gid) || isNaN(count)) throw new Error('data table format wrong');
result = { gid: parseInt(gid), count: parseInt(count), condition: parseInt(condition) };
break;
}
case 'randomReward': {
let [gid, count, frequency] = arr;
if(isNaN(gid) || isNaN(count)) throw new Error('格式错误');
if(isNaN(gid) || isNaN(count)) throw new Error('data table format wrong');
result = { gid: parseInt(gid), count: parseInt(count), frequency: parseInt(frequency) };
break;
}
case 'eventSuitLevel': {
let [min, max] = arr;
if(isNaN(min) || isNaN(max)) throw new Error('格式错误');
if(isNaN(min) || isNaN(max)) throw new Error('data table format wrong');
result = { min: parseInt(min), max: parseInt(max) };
break;
}
case 'attribute': {
let [id, value] = arr;
if(isNaN(id) || isNaN(value)) throw new Error('格式错误');
if(isNaN(id) || isNaN(value)) throw new Error('data table format wrong');
result = { id: parseInt(id), value: parseInt(value) };
break;
}
case 'position': {
let [x, y] = arr;
if(isNaN(x) || isNaN(y)) throw new Error('格式错误');
if(isNaN(x) || isNaN(y)) throw new Error('data table format wrong');
result = { x: parseInt(x), y: parseInt(y) };
break;
}
@@ -184,5 +184,8 @@ export function getRandEelm(source: Array<any> = [], cnt = 1): Array<any> {
export function resResult(status: {code: number, simStr: string}, data = null, customMsg = '') {
const { code, simStr } = status;
if (code !== STATUS.SUCCESS.code) {
console.log(`normal err, code: ${code}, des: ${customMsg || simStr}`);
}
return {code, msg: customMsg || simStr, data};
}