diff --git a/doc/api.md b/doc/api.md index 53e97a8..23cca3a 100644 --- a/doc/api.md +++ b/doc/api.md @@ -220,6 +220,7 @@ | -------- | -------------------------------------- | | shop | 店铺id, 比如 607ff59d4a4e16687a3b7079 | | eid | 测验id, 比如 609e13eeccc78154ac683583 | +| delay | 每题需要增加的延迟时间, 单位秒 | 3. Response: JSON diff --git a/src/api/controllers/exam.controller.ts b/src/api/controllers/exam.controller.ts index 0416eea..111ca6e 100644 --- a/src/api/controllers/exam.controller.ts +++ b/src/api/controllers/exam.controller.ts @@ -20,7 +20,7 @@ class ExamController extends BaseController { @role('anon') @router('post /api/:accountid/exam/list') async list(req, res) { - let { shop, accountid, eid } = req.params + let { shop, accountid, eid, delay } = req.params if (!shop || !validShopId(shop)) { throw new ZError(10, '没有店铺id或者店铺id格式不正确, 测试使用: 607ff59d4a4e16687a3b7079') } @@ -60,10 +60,11 @@ class ExamController extends BaseController { stat.timeLast = now history.members.set(accountid, stat) 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.total = record.qcount - history.timeone = record.timeone + history.timeone = timeone history.difficultyMode = 0 history.qtypes = record.qtypes await history.save()