修改挑战相关接口
This commit is contained in:
parent
07d1de0859
commit
c5a27e30a2
@ -215,6 +215,7 @@
|
||||
| 字段 | 说明 |
|
||||
| -------- | -------------------------------------- |
|
||||
| shop | 店铺id, 比如 607ff59d4a4e16687a3b7079 |
|
||||
| eid | 测验id, 比如 609e13eeccc78154ac683583 |
|
||||
|
||||
3. Response: JSON
|
||||
|
||||
|
@ -18,14 +18,17 @@ class ExamController extends BaseController {
|
||||
@role('anon')
|
||||
@router('post /api/:accountid/exam/list')
|
||||
async list(req, res) {
|
||||
let { shop, accountid } = req.params
|
||||
let { shop, accountid, eid } = req.params
|
||||
if (!shop || !isObjectId(shop)) {
|
||||
throw new ZError(10, '没有店铺id或者店铺id格式不正确, 测试使用: 607ff59d4a4e16687a3b7079')
|
||||
}
|
||||
const now = Date.now()
|
||||
let record = await ShopExam.findOne({shop, beginTime: {$lte: now}, endTime: {$gte: now}, active: true, deleted: false})
|
||||
if (!eid) {
|
||||
throw new ZError(12, '需要指定挑战的id')
|
||||
}
|
||||
let record = await ShopExam.findById(eid)
|
||||
if (!record) {
|
||||
throw new ZError(11, '暂时没有可参加的测试')
|
||||
throw new ZError(11, '暂时没有可参加的挑战')
|
||||
}
|
||||
let params = {}
|
||||
if (record.qtypes && record.qtypes.length > 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user