fix 修复奇遇本答题逻辑

This commit is contained in:
luying
2020-10-19 16:56:22 +08:00
parent 6b9a749a2b
commit 99e50c9c36
7 changed files with 94 additions and 32 deletions
+6
View File
@@ -64,6 +64,12 @@ export const EVENT_TYPE = {
BATTLE: 3 // 战斗
};
export const EVENT_ANSWER_STATUS = {
WAITING: 0,
CORRECT: 1,
WRONG: 2
};
export const EVENT_START_BATTLE = 101;
export const EXPEDITION_INCREASE_POINT = 2; // 远征每成功一次累计的点数
+4 -1
View File
@@ -32,6 +32,8 @@ export const STATUS = {
EVENT_STATUS_ERROR: { code: 20302, simStr: '状态错误' },
EVENT_WRONG_ID: { code: 20303, simStr: '事件id错误' },
EVENT_INFO_NOT_FOUND: { code: 20304, simStr: '未找到该事件' },
EVENT_QUESTION_NOT_FOUND: { code: 20305, simStr: '该事件没有该问题' },
EVENT_QUESTION_NO_ANSWER: { code: 20306, simStr: '没有回答完全部问题' },
// 远征 20400 - 20499
EXPEDITION_MATCH_NO_PLAYER: { code: 20401, simStr: '无法匹配对手' },
EXPEDITION_MISS_WAR_RECORD: { code: 20402, simStr: '未找到该远征记录' },
@@ -73,5 +75,6 @@ export const STATUS = {
GM_DUPLICATE_GM_ACCOUNT: { code: 60006, simStr: '该账号已使用' },
GM_DUPLICATE_API: { code: 60007, simStr: '该接口已存在' },
GM_DUPLICATE_GROUP: { code: 60008, simStr: '该用户组已存在' },
GM_CREATE_ERROR: { code: 60009, simStr: '创建失败' }
GM_CREATE_ERROR: { code: 60009, simStr: '创建失败' },
GM_ROLE_NOT_FOUND: { code: 60010, simStr: '未找到该玩家' }
}
+8
View File
@@ -8,6 +8,8 @@ class Question {
question: string;
@prop({ required: false, type: String })
answer: [string];
@prop({ required: true })
status: number;
}
/**
* 战斗记录接口
@@ -60,6 +62,12 @@ export default class EventRecord extends BaseModel {
return {history: result, turn};
}
public static async saveEventAnswer(eventCode: string, questionId: number, status: number , lean=true ) {
let data = await EventRecordModel.findOneAndUpdate(
{eventCode, 'question.id': questionId}, { $set: {'question.$.status': status} }, {upsert: true, new: true}).lean(lean);
return data;
}
public static async saveEventRecord(eventCode: string, params: {roleId: string, refTime: number, eventId: number, roleName:string, turn?: number, type: number, quality: number, battleId?: number, status: number, position: {x:number, y:number}, question: Array<any> } , lean=true ) {
let doc = new EventRecordModel();
let update = Object.assign(doc.toJSON(), params, {eventCode});
+3 -3
View File
@@ -4,9 +4,9 @@
"dispatchJsonId": 101,
"bg_img_id": 101,
"script_id": 101,
"fixReward": "&",
"conditionReward": "&",
"RandomReward": "&",
"fixReward": "1&2",
"conditionReward": "2&1&1|1&1&0",
"randomReward": "3&1&5",
"warType": 1,
"gk_name": "序章&王越童渊比试",
"kingExp": 100,