Skip to content

专项考试

专项考试

获取学员的考试列表数据

GET /plugins/exam/me/exams

权限

  • 需要认证用户

参数

字段类型必选描述示例
statusstring考试状态finished/unfinished
userIdint用户ID2
examIdint考试ID1
examCreatedTimestring考试创建时间2021-11-01 00:00:00 - 2021-11-03 23:59:59
examStartTimestring考试开始时间2021-11-01 00:00:00 - 2021-11-03 23:59:59
offsetint分页偏离量0
limitint分页数量20

响应

成功响应pageList exam 结构体

字段类型描述
userIdstring成员id
examIdstring考试id
examNamestring考试名称
examTypestring考试类型(grade:评分考试,fullMark:必过考试)
testPaperScorestring考试试卷分数
statusstring考试状态(notStart:未开始,doing:考试中,reviewing:批阅中,finished:已完成,absent:缺考)
resultIdstring考试结果id
endTimestring考试结束时间
scorestring考试得分
remainingResitTimesint剩余考试次数0表示无限制,该字段仅用来描述grade类型考试
canDoExamboolean是否能考试
examCreatedTimestring考试创建时间
examStartTimestring考试开始时间
examLengthstring考试时长
firstResultIdstring首次考试结果ID
firstScorestring首次考试得分
firstPassStatusstring首次考试结果
finishedCountstring已答次数
CertificateRecordCertificateRecord结构体获得证书编码与名称

获取考试说明

GET /plugins/exam/exams/{id}

权限

  • 不需要认证

参数

字段描述
id考试的id

响应

成功响应exam结构体

字段描述
id string考试ID
name string考试名称
type string考试类型(grade:评分考试,fullMark:必过考试)
status string考试状态(draft:草稿published:已发布closed:已关闭)
endTime考试结束时间
length string考试时长
resitTimes string重考次数(0表示不限次数)
score考试试卷总分
passScore考试通过分数
questionsCount考试试卷题目数
remainingResitTimes剩余考试次数(先判断是否必过考试,再看resitTimes是否为0,都不是则剩余考试次数)

开始考试

POST /plugins/exam/me/exam_results

权限

  • 需要认证

参数

字段描述
examId考试id

响应

成功响应结构体实例如下

json
    {
        "exam": {
            "name": "测试所有题型的评分试卷",
            "length": "0",
            "type": "grade",
            "remainingTime": "43"
        },
        "examInfo": {
            "single_choice": {
                "number": 1,
                "score": "2.0"
            },
            "choice": {
                "number": 1,
                "score": "2.0"
            },
            "fill": {
                "number": 1,
                "score": "50.0"
            },
            "uncertain_choice": {
                "number": 1,
                "score": "2.0"
            },
            "determine": {
                "number": 1,
                "score": "2.0"
            },
            "essay": {
                "number": 1,
                "score": "2.0"
            }
        },
        "testPaper": {
            "score": "10.0",
            "questionsCount": "5"
        },
        "examResult": {
            "id": "123",
            "beginTime": "1508117500"
        },
        "questions": [
            {
                "id": "10",
                "type": "single_choice",
                "stem": "<p>1+1的值是多少</p>\r\n",
                "score": "2.0",
                "metas": {
                    "choices": [
                        "<p>11</p>\r\n",
                        "<p>2</p>\r\n",
                        "<p>0</p>\r\n",
                        "<p>3</p>\r\n"
                    ]
                },
                "seq": "1",
                "missScore": "0.0"
            },
            {
                "id": "11",
                "type": "choice",
                "stem": "<p>下面哪俩个的值相加等于11</p>\r\n",
                "score": "2.0",
                "metas": {
                    "choices": [
                        "<p>7+4</p>\n",
                        "<p>1+1</p>\n",
                        "<p>5+6</p>\n",
                        "<p>10+1</p>\n"
                    ]
                },
                "seq": "2",
                "missScore": "0.0"
            },
            {
                "id": "12",
                "type": "essay",
                "stem": "<p>什么是世界上最好的语言</p>\r\n",
                "score": "2.0",
                "metas": [],
                "seq": "3",
                "missScore": "0.0"
            },
            {
                "id": "13",
                "type": "uncertain_choice",
                "stem": "<p>这是一道选A、B的不定项选择题</p>\r\n",
                "score": "2.0",
                "metas": {
                    "choices": [
                        "<p>A</p>\r\n",
                        "<p>B</p>\r\n",
                        "<p>C</p>\r\n",
                        "<p>D</p>\r\n"
                    ]
                },
                "seq": "4",
                "missScore": "0.0"
            },
            {
                "id": "14",
                "type": "determine",
                "stem": "<p>php是最好的语言</p>\r\n",
                "score": "2.0",
                "metas": [],
                "seq": "5",
                "missScore": "0.0"
            },
            {
                "id": "15",
                "type": "fill",
                "stem": "<p>天[[1]]空[[2]]题[[3]]</p>\r\n",
                "score": "50.0",
                "seq": "1",
                "missScore": "0.0"
            }
        ]
    }

exam字段描述

字段描述
name考试名称
length考试时长限制单位秒,0表示不限时长
remainingTime剩余考试时间(单位:秒,如果length为0不显示)
type考试类型 fullMark必过考试,grade评分考试

testPaper字段描述

字段描述
score试卷总分
questionsCount试卷题目总数

examResult字段描述

字段描述
id考试结果id
beginTime进入考试的时间

questions字段描述

字段描述
id题目id
type题目类型(single_choice:单选题,choice:多选题,full:填空题,uncertain_choice:不定项选择题,determine:判断题,essay:问答题)
stem题干
score题目分数
metas选择题的选项
missScore漏选分值(仅多选和不定项选择)

结束考试提交结果

PATCH /plugins/exam/me/exam_results/{examResultId}

权限

  • 需要认证

参数

字段描述
examResultId考试结果id

试卷答案以json格式传送(题目从上到下依次是单选题,多选题,不定项选择,判断,问答)

json
{
    "answers": [
        {
            "questionId": "15", 
            "answer": ["0"]
        }, 
        {
            "questionId": "11", 
            "answer": ["0","1","3"]
        }, 
        {
            "questionId": "12", 
            "answer": ["0","1"]
        }, 
        {
            "questionId": "13", 
            "answer": ["1"]
        }, 
        {
            "questionId": "14", 
            "answer": ["php是最好的语言"]
        },
        {
            "questionId": "15",
            "answer": ["1","2","3"]
        }
    ]
}

提交成功

字段描述
status提交状态

检查必过考试答案

POST /plugins/exam/me/exam_result_check

参数

字段描述
answers当前用户做的试卷答案
examResultId考试结果id

试卷答案和考试的id以json格式传送(题目从上到下依次是单选题,多选题,不定项选择,判断)

json
{
    "answers": [
        {
            "questionId": "15", 
            "answer": "0"
        }, 
        {
            "questionId": "11", 
            "answer": "0,1,3"
        }, 
        {
            "questionId": "12", 
            "answer": "0,1"
        }, 
        {
            "questionId": "13", 
            "answer": "1"
        }, 
        {
            "questionId": "14", 
            "answer": "php是最好的语言"
        }
    ],
    "examId": "2"
}

响应

成功响应结构体实例如下

json
{
    "status": "wrong",
    "checkAnswers": [
        {
            "questionId": "1",
            "checkStatus": "right",
            "type": "single_choice"
        },
        {
            "questionId": "2",
            "checkStatus": "right",
            "type": "choice"
        },
        {
            "questionId": "3",
            "checkStatus": "right",
            "type": "uncertain_choice"
        },
        {
            "questionId": "4",
            "checkStatus": "wrong",
            "type": "determine"
        }
    ]
}

字段描述

字段描述
status全部题目正确right, 有错题wrong

answer字段描述

字段描述
questionId试卷题目题号
checkStatus当前题目正确状态:正确(right),错误(wrong)
type试卷题目类型:单选(single_choice),多选(choice),不定项(uncertain_choice),判断(determine)

查看考试结果

GET /plugins/exam/me/exam_results/{id}

权限

  • 需要认证

参数

字段描述
id考试结果id(examResultId)
answerStatus答案状态(all:所有,right:正确的,wrong:错误的)

响应

成功响应examResult结构体 结构体示例如下:

json
{
    "examName": "测试随机试卷考试",
    "testPaperScore": "100.0",
    "score": "70.0",
    "submitTime": "0",
    "usedTime": "3600",
    "status": "reviewing",
    "canRedoExam": false,
    "questionResults": [
        {
            "id": "10",
            "type": "single_choice",
            "stem": "<p>1+1的值是多少</p>\r\n",
            "score": "2.0",
            "answer": [
                "1"
            ],
            "analysis": "",
            "metas": {
                "choices": [
                    "<p>11</p>\r\n",
                    "<p>2</p>\r\n",
                    "<p>0</p>\r\n",
                    "<p>3</p>\r\n"
                ]
            },
            "testResult": {
                "status": "right",
                "score": "2.0",
                "answer": [
                    "1"
                ],
                "teacherSay": null
            },
            "seq": "1",
            "missScore": "0.0"
        },
        {
            "id": "11",
            "type": "choice",
            "stem": "<p>下面哪俩个的值相加等于11</p>\r\n",
            "score": "2.0",
            "answer": [
                "0",
                "1",
                "3"
            ],
            "analysis": "",
            "metas": {
                "choices": [
                    "<p>7+4</p>\n",
                    "<p>1+1</p>\n",
                    "<p>5+6</p>\n",
                    "<p>10+1</p>\n"
                ]
            },
            "testResult": {
                "status": "right",
                "score": "2.0",
                "answer": [
                    "0",
                    "1",
                    "3"
                ],
                "teacherSay": null
            },
            "seq": "2",
            "missScore": "0.0"
        },
        {
            "id": "12",
            "type": "essay",
            "stem": "<p>什么是世界上最好的语言</p>\r\n",
            "score": "2.0",
            "answer": [
                "<p>php是世界上最好的语言</p>\n"
            ],
            "analysis": "",
            "metas": [],
            "testResult": {
                "status": "none",
                "score": "0.0",
                "answer": "php是最好的语言",
                "teacherSay": null
            },
            "seq": "3",
            "missScore": "0.0"
        },
        {
            "id": "13",
            "type": "uncertain_choice",
            "stem": "<p>这是一道选A、B的不定项选择题</p>\r\n",
            "score": "2.0",
            "answer": [
                "0",
                "1"
            ],
            "analysis": "",
            "metas": {
                "choices": [
                    "<p>A</p>\r\n",
                    "<p>B</p>\r\n",
                    "<p>C</p>\r\n",
                    "<p>D</p>\r\n"
                ]
            },
            "testResult": {
                "status": "partRight",
                "score": "0.0",
                "answer": [
                    "1"
                ],
                "teacherSay": null
            },
            "seq": "4",
            "missScore": "0.0"
        },
        {
            "id": "14",
            "type": "determine",
            "stem": "<p>php是最好的语言</p>\r\n",
            "score": "2.0",
            "answer": [
                "1"
            ],
            "analysis": "",
            "metas": [],
            "seq": "5",
            "missScore": "0.0"
        }
    ]
}
字段描述
examName考试名
testPaperScore试卷总分
score考试得分
submitTime提交时间
usedTime考试所用时间 单位秒
statusfinished已完成,reviewing批阅中
canRedoExam能否重考

题目对象(questionResults)

字段描述
id题目id
type题目类型(single_choice:单选题,choice:多选题,uncertain_choice:不定项选择题,determine:判断题,essay:问答题)
stem题干
score题目分数
answer题目答案(选择题的答案为选项的序号,序号从0开始,判断题 0表示错误,1表示正确)
analysis题目分析
metas选择题的选项
missScore漏选分值(仅多选和不定项选择)

答案对象(testResult)

字段描述
statusright(正确),wrong(错误), partRight(部分正确), noAnswer(未作答)
score所得分数
answer作答答案(选择题的答案为选项的序号,序号从0开始,判断题 0表示错误,1表示正确)
teacherSay老师评语

检测题目答案是否正确

GET /plugins/exam/question_answers/{questionId}

权限

  • 需要认证
  • 需要当前考试id
  • 该接口只能用于客观题正确性的校验(单选,多选,,不定项,判断)

参数

字段描述
questionId题目id
examId考试id
answer答案

单选题实例 GET /api/plugins/exam/question_answers/10?examId=7&answer=1 (0,1,2,3代表选项序号)

多选题实例 GET /api/plugins/exam/question_answers/11?examId=7&answer=0,1,3 (0,1,2,3代表选项序号)

不定项选择题实例 GET /api/plugins/exam/question_answers/13?examId=7&answer=0,1 (0,1,2,3代表选项序号)

判断题 GET /api/plugins/exam/question_answers/14?examId=7&answer=1 (0:正确,1:错误)

响应

字段描述
status答案状态(right:正确,wrong:错误)
rightAnswer正确答案

保存考试进度

POST /plugins/exam/exam/{examResultId}/submit

权限

  • 需要认证

参数

字段是否必选类型描述
examResultIdint考试结果id
answersjson答案详情(请求体)

请求体

json
{
  "result14":{"questionId":"14","answer":["2"]},
  "result15":{"questionId":"15","answer":["<p>i+m+you</p>\n"]}
}

成功响应

字段类型描述
statusstring成功时返回success