type为3的题目不再返回正确答案

This commit is contained in:
zhl 2021-05-25 20:12:08 +08:00
parent c65a9a500b
commit 15ab8ebbf4
3 changed files with 4 additions and 2 deletions

View File

@ -83,6 +83,7 @@
{ {
result: 1, //答题结果 1: 正确, 0 : 错误 result: 1, //答题结果 1: 正确, 0 : 错误
gameResult: 0, // 当前局游戏结果 0: 未完成, -1: 失败, 1: 胜利 gameResult: 0, // 当前局游戏结果 0: 未完成, -1: 失败, 1: 胜利
answer: '正确答案',
"stats": { // 当局的状态 "stats": { // 当局的状态
"1111": { "1111": {
"answer": {// 每一题的结果, key为题目的id, 值为answer在答案中的index值, 0为正确值, -1为超时, 其他都为错误 "answer": {// 每一题的结果, key为题目的id, 值为answer在答案中的index值, 0为正确值, -1为超时, 其他都为错误
@ -271,6 +272,7 @@
result: 1, //答题结果 1: 正确, 0 : 错误 result: 1, //答题结果 1: 正确, 0 : 错误
gameResult: 0, // 当前局游戏结果 0: 未完成, -1: 失败, 1: 胜利 gameResult: 0, // 当前局游戏结果 0: 未完成, -1: 失败, 1: 胜利
overtime: 0, // 当前回答是否超时 0: 未超时, 1: 超时 overtime: 0, // 当前回答是否超时 0: 未超时, 1: 超时
answer: '正确答案',
"stats": { // 当局的状态 "stats": { // 当局的状态
"1111": { "1111": {
"answer": {// 每一题的结果, key为题目的id, 值为answer在答案中的index值, 0为正确值, -1为超时, 其他都为错误 "answer": {// 每一题的结果, key为题目的id, 值为answer在答案中的index值, 0为正确值, -1为超时, 其他都为错误

View File

@ -134,7 +134,7 @@ class ExamController extends BaseController {
history.markModified('members') history.markModified('members')
await history.save() await history.save()
let gameResult = 0 let gameResult = 0
let rspData: any = { result: result === 0, answer: record.answers[0], stats: history.members, overtime } let rspData: any = { result: result === 0, answer: record.type === 3 ? '' : record.answers[0], stats: history.members, overtime }
if (statMap.answer.size >= history.questions.size) { if (statMap.answer.size >= history.questions.size) {
gameResult = 1 gameResult = 1
} }

View File

@ -131,7 +131,7 @@ class PuzzleController extends BaseController {
history.markModified('members') history.markModified('members')
let gameResult = 0 let gameResult = 0
await history.save() await history.save()
let rspData: any = { result: result === 0, answer: record.answers[0], stats: history.members } let rspData: any = { result: result === 0, answer: record.type === 3 ? '' : record.answers[0], stats: history.members }
if (mode == 1) { if (mode == 1) {
let score = result === 0 ? calcPvpScore(history.scheduleKey, statMap.comboCount) : 0 let score = result === 0 ? calcPvpScore(history.scheduleKey, statMap.comboCount) : 0
if (record.type === 3) { if (record.type === 3) {