专项考试
专项考试
获取学员的考试列表数据
GET /plugins/exam/me/exams
权限
参数
字段 |
类型 |
必选 |
描述 |
示例 |
status |
string |
否 |
考试状态 |
finished/unfinished |
userId |
int |
否 |
用户ID |
2 |
examId |
int |
否 |
考试ID |
1 |
examCreatedTime |
string |
否 |
考试创建时间 |
2021-11-01 00:00:00 - 2021-11-03 23:59:59 |
examStartTime |
string |
否 |
考试开始时间 |
2021-11-01 00:00:00 - 2021-11-03 23:59:59 |
offset |
int |
否 |
分页偏离量 |
0 |
limit |
int |
否 |
分页数量 |
20 |
响应
成功响应pageList exam 结构体
字段 |
类型 |
描述 |
userId |
string |
成员id |
examId |
string |
考试id |
examName |
string |
考试名称 |
examType |
string |
考试类型(grade:评分考试,fullMark:必过考试) |
testPaperScore |
string |
考试试卷分数 |
status |
string |
考试状态(notStart:未开始,doing:考试中,reviewing:批阅中,finished:已完成,absent:缺考) |
resultId |
string |
考试结果id |
endTime |
string |
考试结束时间 |
score |
string |
考试得分 |
remainingResitTimes |
int |
剩余考试次数0表示无限制,该字段仅用来描述grade类型考试 |
canDoExam |
boolean |
是否能考试 |
examCreatedTime |
string |
考试创建时间 |
examStartTime |
string |
考试开始时间 |
examLength |
string |
考试时长 |
firstResultId |
string |
首次考试结果ID |
firstScore |
string |
首次考试得分 |
firstPassStatus |
string |
首次考试结果 |
finishedCount |
string |
已答次数 |
CertificateRecord |
CertificateRecord结构体 |
获得证书编码与名称 |
获取考试说明
GET /plugins/exam/exams/{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
权限
参数
响应
成功响应结构体实例如下
{
"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格式传送(题目从上到下依次是单选题,多选题,不定项选择,判断,问答)
{
"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"]
}
]
}
提交成功
检查必过考试答案
POST /plugins/exam/me/exam_result_check
参数
字段 |
描述 |
answers |
当前用户做的试卷答案 |
examResultId |
考试结果id |
试卷答案和考试的id以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"
}
响应
成功响应结构体实例如下
{
"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结构体
结构体示例如下:
{
"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 |
考试所用时间 单位秒 |
status |
finished已完成,reviewing批阅中 |
canRedoExam |
能否重考 |
题目对象(questionResults)
字段 |
描述 |
id |
题目id |
type |
题目类型(single_choice:单选题,choice:多选题,uncertain_choice:不定项选择题,determine:判断题,essay:问答题) |
stem |
题干 |
score |
题目分数 |
answer |
题目答案(选择题的答案为选项的序号,序号从0开始,判断题 0表示错误,1表示正确) |
analysis |
题目分析 |
metas |
选择题的选项 |
missScore |
漏选分值(仅多选和不定项选择) |
答案对象(testResult)
字段 |
描述 |
status |
right(正确),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
权限
参数
字段 |
是否必选 |
类型 |
描述 |
examResultId |
是 |
int |
考试结果id |
answers |
是 |
json |
答案详情(请求体) |
请求体
{
"result14":{"questionId":"14","answer":["2"]},
"result15":{"questionId":"15","answer":["<p>i+m+you</p>\n"]}
}
成功响应
字段 |
类型 |
描述 |
status |
string |
成功时返回success |