修改超时消息的处理方式
This commit is contained in:
parent
a56c87eea8
commit
efd6b15088
@ -93,10 +93,16 @@ class PuzzleController extends BaseController {
|
||||
if (!history) {
|
||||
throw new ZError(13, 'not found match info')
|
||||
}
|
||||
let record = await Puzzle.findById(id)
|
||||
if (!record) {
|
||||
throw new ZError(12, 'question not found')
|
||||
}
|
||||
let result = record.a1 == answer ? 1 : 0
|
||||
if (type == 1) {
|
||||
result = 0
|
||||
}
|
||||
if (history.status == 9 || history.hasExpired()) {
|
||||
history.status = 9
|
||||
await history.save()
|
||||
throw new ZError(17, 'match end')
|
||||
result = 0
|
||||
}
|
||||
if (!history.members.has(accountid)) {
|
||||
throw new ZError(14, 'not in current match')
|
||||
@ -108,14 +114,7 @@ class PuzzleController extends BaseController {
|
||||
if (statMap.answer.has(id)) {
|
||||
throw new ZError(15, 'current question already answered')
|
||||
}
|
||||
let record = await Puzzle.findById(id)
|
||||
if (!record) {
|
||||
throw new ZError(12, 'question not found')
|
||||
}
|
||||
let result = record.a1 == answer ? 1 : 0
|
||||
if (type == 1) {
|
||||
result = 0
|
||||
}
|
||||
|
||||
statMap.answer.set(id, result)
|
||||
if (result == 1) {
|
||||
statMap.rightCount++
|
||||
|
@ -8,7 +8,7 @@ import {
|
||||
import { BaseModule } from './Base'
|
||||
|
||||
@dbconn()
|
||||
@index({ accoundId: 1}, { unique: true })
|
||||
@index({ accountId: 1}, { unique: true })
|
||||
@modelOptions({ schemaOptions: { collection: 'game_user', timestamps: true } })
|
||||
class GameUserClass extends BaseModule {
|
||||
@prop()
|
||||
|
Loading…
x
Reference in New Issue
Block a user