Merge branch 'statusCode' of gitlab.trgame.cn:zyztech/zyz_server
Conflicts: game-server/app/servers/battle/handler/eventBattleHandler.ts
This commit is contained in:
@@ -5,6 +5,8 @@ import { RoleModel } from '../../../db/Role';
|
||||
import { EVENT_STATUS, EVENT_RECORD_STATUS } from '../../../consts/consts';
|
||||
import { checkEvent, getEventTime, refreshEvent, checkEventStatus, getEventSuccessStatus, checkQuizParam } from '../../../services/eventSercive';
|
||||
import { handleFixedReward } from '../../../services/rewardService';
|
||||
import { STATUS } from '../../../consts/statusCode';
|
||||
import { resResult } from '../../../pubUtils/util';
|
||||
|
||||
export default function(app: Application) {
|
||||
return new EventBattleHandler(app);
|
||||
@@ -22,7 +24,6 @@ export class EventBattleHandler {
|
||||
|
||||
let now = new Date();
|
||||
let t = getEventTime(now);
|
||||
console.log(t, eventStatus)
|
||||
|
||||
let event: Array<EventRecord>;
|
||||
if (eventStatus == EVENT_STATUS.STARTING) {
|
||||
@@ -35,12 +36,7 @@ export class EventBattleHandler {
|
||||
event = await refreshEvent(num, roleId, roleName, t);
|
||||
}
|
||||
}
|
||||
return {
|
||||
code: 200,
|
||||
data: {
|
||||
event
|
||||
}
|
||||
}
|
||||
return resResult(STATUS.SUCCESS, { list: event });
|
||||
}
|
||||
|
||||
// 获取关卡列表
|
||||
@@ -52,25 +48,27 @@ export class EventBattleHandler {
|
||||
|
||||
let event = await EventRecordModel.getEventRecordByCode(roleId, eventCode);
|
||||
if(!event) {
|
||||
return { code: 202, data: '未找到记录' }
|
||||
return resResult(STATUS.EVENT_RECORD_NOT_FOUND);
|
||||
}
|
||||
let { status, type, eventId: dataEventId, question } = event;
|
||||
|
||||
if(!checkEventStatus(type, status)) {
|
||||
return { code: 202, data: '状态错误' }
|
||||
let flag = checkEventStatus(type, status);
|
||||
if(!flag) {
|
||||
return resResult(STATUS.EVENT_STATUS_ERROR);
|
||||
}
|
||||
if(!checkQuizParam(answer, question)) {
|
||||
return { code: 202, data: '参数错误' }
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
}
|
||||
let isSuccess = getEventSuccessStatus(type, status, answer);
|
||||
|
||||
|
||||
if(dataEventId != eventId) {
|
||||
return { code: 202, data: '事件id错误' }
|
||||
return resResult(STATUS.EVENT_WRONG_ID);
|
||||
}
|
||||
let dicEvent = getGamedata('dic_zyz_event');
|
||||
let curEvent = dicEvent.find(cur => cur.eventID == eventId);
|
||||
if(!curEvent) {
|
||||
return { code: 202, data: '未找到该事件' };
|
||||
return resResult(STATUS.EVENT_INFO_NOT_FOUND);
|
||||
}
|
||||
|
||||
// 保存状态
|
||||
@@ -86,15 +84,12 @@ export class EventBattleHandler {
|
||||
}
|
||||
// 推送消息刷新
|
||||
await checkEvent(this.app, session, true);
|
||||
return {
|
||||
code: 200,
|
||||
data: {
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
isSuccess,
|
||||
eventCode: result.eventCode,
|
||||
eventId: result.eventId,
|
||||
status: result.status,
|
||||
goods
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user