挑战模式增加每题间隔时间的上报
This commit is contained in:
parent
16dc02e127
commit
ec17dbd563
@ -220,6 +220,7 @@
|
|||||||
| -------- | -------------------------------------- |
|
| -------- | -------------------------------------- |
|
||||||
| shop | 店铺id, 比如 607ff59d4a4e16687a3b7079 |
|
| shop | 店铺id, 比如 607ff59d4a4e16687a3b7079 |
|
||||||
| eid | 测验id, 比如 609e13eeccc78154ac683583 |
|
| eid | 测验id, 比如 609e13eeccc78154ac683583 |
|
||||||
|
| delay | 每题需要增加的延迟时间, 单位秒 |
|
||||||
|
|
||||||
3. Response: JSON
|
3. Response: JSON
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ class ExamController extends BaseController {
|
|||||||
@role('anon')
|
@role('anon')
|
||||||
@router('post /api/:accountid/exam/list')
|
@router('post /api/:accountid/exam/list')
|
||||||
async list(req, res) {
|
async list(req, res) {
|
||||||
let { shop, accountid, eid } = req.params
|
let { shop, accountid, eid, delay } = req.params
|
||||||
if (!shop || !validShopId(shop)) {
|
if (!shop || !validShopId(shop)) {
|
||||||
throw new ZError(10, '没有店铺id或者店铺id格式不正确, 测试使用: 607ff59d4a4e16687a3b7079')
|
throw new ZError(10, '没有店铺id或者店铺id格式不正确, 测试使用: 607ff59d4a4e16687a3b7079')
|
||||||
}
|
}
|
||||||
@ -60,10 +60,11 @@ class ExamController extends BaseController {
|
|||||||
stat.timeLast = now
|
stat.timeLast = now
|
||||||
history.members.set(accountid, stat)
|
history.members.set(accountid, stat)
|
||||||
history.activityId = eid
|
history.activityId = eid
|
||||||
history.expire = Date.now() + (record.qcount * record.timeone || 90) * 1000
|
let timeone = (record.timeone || 10) + ( delay || 0 )
|
||||||
|
history.expire = Date.now() + timeone * 1000
|
||||||
history.type = 2
|
history.type = 2
|
||||||
history.total = record.qcount
|
history.total = record.qcount
|
||||||
history.timeone = record.timeone
|
history.timeone = timeone
|
||||||
history.difficultyMode = 0
|
history.difficultyMode = 0
|
||||||
history.qtypes = record.qtypes
|
history.qtypes = record.qtypes
|
||||||
await history.save()
|
await history.save()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user