考试

优质
小牛编辑
116浏览
2023-12-01

试卷结构

[
    {
        "type":"multiple_choice",   // 题目类型
        "multi_select": 0,          // 是否多选
        "name":"选择题",             // 题目名称
        "must":1,   // 1为必填; 0为选填
        "score_method":1,   // 计分方式: 1为答案完全对应; 2为每个选项对应分值
        "score": 5, // 分值
        "get_score": 5, // 得到的分数(试卷批阅后添加该字段)
        "question":{
            "title":"先有鸡还是先有蛋?",  // 题目描述
            "imgs":["url1","url2","url3"]   // 题目图片
        },
        "options":[ // 选项(选项里的内容全部用字符串,不用数字,方便改卷)
            {
                "title": "先有鸡",  // 选项1
                "imgs":["url1","url2","url3"]   // 选项图片
            },
            {
                "title": "先有蛋",  // 选项2
                "imgs":["url1","url2","url3"]   // 选项图片
            }
        ],
        "answers":[ // 设计为这种结构,便于后期做多项填空和多项选择的扩展
            {
                "answer":"1",   // 答案(对应选项序号,答案内容全部用字符串,不用数字,方便改卷)
            }
        ],
        "sheet":[   // 试卷批阅后,在原有基础上加上考生答案
            {
                "answer":"1"
            },
            {
                "answer":"2"
            }
        ],
        "analysis":"瞎猜的",    // 答案解析
        "analysis_imgs": ["url1","url2","url3"]    // 答案解析图片
    },
    {
        "type":"judge",
        "name":"判断题",
        "must":1,
        "score_method":1,
        "score": 5,
        "question":{
            "title":"渣男锡纸烫,肥宅大秃顶?",
            "imgs":["url1","url2","url3"]
        },
        "answers":[
            {
                "answer":"true",   
            }
        ],
        "analysis":"肥宅也要做渣男"
    },
    {
        "type":"blank",
        "name":"填空题",
        "must":1,
        "score_method":1,
        "score": 5,
        "question":{
            "title":"___是世界上最好的语言",
            "imgs":["url1","url2","url3"]
        },
        "answers":[
            {
                "answer":"PHP|汉语",    // 答案(用"|"分隔,答对其中一个即给分) 
            }
        ],
        "analysis":"全世界都在说中国话"
    },
    {
        "type":"multiple_choice",
        "multi_select": 1,  
        "name":"多项选择题",
        "must":1,
        "score_method":2,
        "score": 5,
        "question":{
            "title":"以下哪些项目隶属于目睹直播?",
            "imgs":["url1","url2","url3"]
        },
        "options":[
            {
                "title": "目睹有课",
                "imgs":["url1","url2","url3"]
            },
            {
                "title": "目睹直播",
                "imgs":["url1","url2","url3"]
            },
            {
                "title": "企播",
                "imgs":["url1","url2","url3"]
            },
            {
                "title": "扫脸支付",
                "imgs":["url1","url2","url3"]
            }
        ],
        "answers":[
            {
                "answer":"1",
                "score":1   // 若选择方式2,每个答案有独立的分值
            },
            {
                "answer":"2",
                "score":1
            },
            {
                "answer":"3",
                "score":3
            }
        ],
        "analysis":"无"
    },
    {
        "type":"multi_blank",
        "name":"多项填空题",
        "must":1,
        "score_method":2,
        "score": 6,
        "question":{
            "title":"___明月光,疑似___霜。举头望明月,低头思___。",
            "imgs":["url1","url2","url3"]
        },
        "answers":[
            {
                "answer":"床前",
                "score":2   // 若选择方式2,每个答案有独立的分值
            },
            {
                "answer":"地上",
                "score":2
            },
            {
                "answer":"故乡",
                "score":2
            }
        ],
        "analysis":"李白说的"
    }
]

答卷结构

[
    {
        "answers":[
            {
                "answer":"1"
            }
        ]
    },
    {
        "answers":[
            {
                "answer":"false",  
            }
        ]
    },
    {
        "answers":[
            {
                "answer":"汉语"
            }
        ]
    },
    {
        "answers":[
            {
                "answer":"1"
            },
            {
                "answer":"2"
            },
            {
                "answer":"3"
            }
        ]
    },
    {
        "answers":[
            {
                "answer":"床前"
            },
            {
                "answer":"地上"
            },
            {
                "answer":"故乡"
            }
        ]
    }
]

创建考试(需要权限)

POST /examination/api/create_exam

请求参数

参数描述取值
acd_id频道HashIDstring
name考试名称string

例如:

{
    "actid": "xxxx",
    "name": "xxxx",
}

返回参数

参数描述取值
errcode错误码int

例如:

{
    "errcode": 1000
}

删除考试(需要权限)

POST /examination/api/delete_exam

请求参数

参数描述取值
eid考试IDstring

例如:

{
    "eid": "xxxx"
}

返回参数

参数描述取值
errcode错误码int

例如:

{
    "errcode": 1000
}

更新考试基本信息(需要权限)

POST /examination/api/update_exam_basic

请求参数

参数描述取值
eid考试IDstring
name考试名称string
description考试藐视string
time_limit考试时长int
report_type考后报考类型int
permanent考试是否永久有效bool
end_at考试截止时间string

例如:

{
    "eid": "xxxx",
    "name": "xxxx",
    "description": "xxxx",
    "time_limit": 123,  // 考试时长,单位/分钟
    "report_type": 1,   // 1为不显示报告,2为仅显示成绩,3为显示所有报告内容
    "permanent": true,
    "end_at": time     // 传空值表示始终有效
}

返回参数

参数描述取值
errcode错误码int

例如:

{
    "errcode": 1000
}

开始/结束考试(需要权限)

POST /examination/api/start_stop_exam

请求参数

参数描述取值
eid考试IDstring
actid频道HashIDstring
status考试状态int

例如:

{
    "eid": "xxxx",
    "actid": "xxxx",
    "status": 1   // 1为开始,对应状态使用中; 0为结束,对应状态未使用
}

返回参数

参数描述取值
errcode错误码int

例如:

{
    "errcode": 1000
}

查询考试列表(需要权限)

GET /examination/api/list_exams?actid=xxx&page=xxx&size=xxx

返回参数

参数描述取值
errcode错误码int
total_num总考试数int
total_page总页数int
page_num页码int
page_size页面大小int

例如:

{
    "errcode": 1000,
    "total_num": 123,
    "total_page": 123,
    "page_num": 123,
    "page_size": 123,
    "result":[
        {
            "eid": "xxx",
            "name": "xxxx",
            "create_at": "2006-01-02 15:04:05", 
            "end_at": "2006-01-02 15:04:05",    // 空值表示始终有效
            "status": 1,   // 1为开始,对应状态使用中; 0为结束,对应状态未使用
            "permanent": true,
            "examinee_num": 123, // 考试人数
            "description": "xxxx",
            "time_limit": 123,  // 考试时长,单位/分钟
            "report_type": 1   // 1为不显示报告,2为仅显示成绩,3为显示所有报告内容
        }
    ]
}

查询频道考试情况(不需要权限)

GET /examination/api/get_using_exam?actid=xxx

返回参数

参数描述取值
errcode错误码int
open是否开启考试bool
eid考试IDstring
name考试名称string
end_at考试截止时间string
permanent考试是否永久有效bool
description考试描述string
time_limit考试时长int
report_type考后报告类型int
status考试状态int
sheet考卷内容string

例如:

{
    "errcode": 1000,
    "open": true,   // true表示该频道有考试; false表示该频道没有考试,则下面字段皆为空值
    "eid": "xxx",
    "name": "xxxx",
    "end_at": "2006-01-02 15:04:05",
    "permanent": true,
    "description": "xxxx",
    "time_limit": 123,  // 考试时长,单位/分钟
    "report_type": 1,   // 1为不显示报告,2为仅显示成绩,3为显示所有报告内容
    "status": 1,   // 0为未参加过考试; 1考试中; 2已完成考试(仅当为1时,sheet带有内容)
    "sheet": "xxx"
}

更新试卷(需要权限)

POST /examination/api/update_paper

请求参数

参数描述取值
eid考试IDstring
paper答卷内容string

例如:

输入
{
    "eid": "xxxx",
    "paper": "xxxx" 
}

返回参数

参数描述取值
errcode错误码int

例如:

返回 200
{
    "errcode": 1000
}

获取带有答案的试卷(需要权限)

GET /examination/api/get_paper_with_answer?eid=xxx

返回参数

参数描述取值
errcode错误码int
total_score卷面总分int
paper答卷内容string

例如:

返回 200
{
    "errcode": 1000,
    "total_score": 123,   // 卷面总分
    "paper": "xxxx"    // 答卷内容
}

获取不带答案的试卷(不需要权限)

GET /examination/api/get_paper_without_answer?eid=xxx

返回参数

参数描述取值
errcode错误码int
total_score卷面总分int
paper答卷内容string

例如:

返回 200
{
    "errcode": 1000,
    "total_score": 123,   // 卷面总分
    "paper": "xxxx"    // 答卷内容
}

提交答卷(不需要权限)

POST /examination/api/upload_answer_sheet

请求参数

参数描述取值描述
actid频道HashIDstring
eid考试IDstring
status考试状态int0为考试中; 1为完成考试,后续不允许提交
sheet考卷内容string

例如:

{
    "actid": "xxxx",
    "eid": "xxxx",
    "status": 1,     // 0为考试中; 1为完成考试,后续不允许提交
    "sheet": "xxxx"
}

返回参数

参数描述取值
errcode错误码int

例如:

返回 200
{
    "errcode": 1000
}

查询统计分析基本信息列表(需要权限)

GET /examination/api/list_answer_sheet?actid=xxx&eid=xxx&page=xxx&size=xxx

返回参数

参数描述取值
errcode错误码int
total_num总数int
total_page总页数int
page_num页码int
page_size页面大小int

例如:

{
    "errcode": 1000,
    "total_num": 123,
    "total_page": 123,
    "page_num": 123,
    "page_size": 123,
    "result":[
        {
            "sid": "xxx",
            "uid": 123,
            "nick_name": "xxxx",
            "eid": "xxxx",
            "roll_score": 123,
            "total_score": 123,
            "start_at": "2006-01-02 15:04:05",
            "end_at": "2006-01-02 15:04:05",
            "duration": 123,  // 考试用时,单位秒
            "status": 1   // 0为考试中; 1为完成考试,未改卷; 2为已改卷
        }
    ]
}

获取答卷详情(需要权限)

GET /examination/api/get_answer_sheet?actid=xxx&uid=xxx&eid=xxx

返回参数

参数描述取值说明
errcode错误码int
sid答卷IDint
uid考生IDint
eid考试IDint
roll_score卷面分数int
total_score试卷总分int
start_at开始答卷时间string
end_at交卷时间string
uration考试用时int考试用时,单位秒
status考试状态int0为考试中; 1为完成考试,未改卷; 2为已改卷
sheet考卷内容string

例如:

{
    "errcode": 1000,
    "sid": "xxx",
    "uid": 123,
    "nick_name": "xxxx",
    "eid": "xxxx",
    "roll_score": 123,
    "total_score": 123,
    "start_at": "2006-01-02 15:04:05",
    "end_at": "2006-01-02 15:04:05",
    "duration": 123,  // 考试用时,单位秒
    "status": 1,  // 0为考试中; 1为完成考试,未改卷; 2为已改卷
    "sheet": "xxxx"
}

查询观众考试报告列表(不需要权限)

GET /examination/api/list_sheet_report?actid=xxx

返回参数

参数描述取值
errcode错误码int

例如:

{
    "errcode": 1000,
    "result":[
        {
            "sid": "xxx",
            "uid": 123,
            "eid": "xxxx",
            "name": "xxxx",
            "roll_score": 123,
            "total_score": 123,
            "start_at": "2006-01-02 15:04:05",
            "end_at": "2006-01-02 15:04:05",
            "status": 1,    // 0为考试中; 1为完成考试,未改卷; 2为已改卷
            "report_type": 1,   // 1为不显示报告,2为仅显示成绩,3为显示所有报告内容
        }
    ]
}

获取观众考试报告详情(不需要权限)

GET /examination/api/get_sheet_report?actid=xxx&uid=xxx&eid=xxx

返回参数

参数描述取值描述
errcode错误码int
sid答卷IDint
uid考生IDint
eid考试IDint
roll_score卷面分数int
total_score考卷总分int
start_atstring
end_at考试开始时间string
status考试结束时间int0为考试中; 1为完成考试,未改卷; 2为已改卷
sheet考卷内容string

例如:

{
    "errcode": 1000,
    "sid": "xxx",
    "uid": 123,
    "eid": "xxxx",
    "roll_score": 123,
    "total_score": 123,
    "start_at": "2006-01-02 15:04:05",
    "end_at": "2006-01-02 15:04:05",
    "status": 1,   // 0为考试中; 1为完成考试,未改卷; 2为已改卷
    "sheet": "xxxx"
}

获取统计分析数据(需要权限)

GET /examination/api/get_analysis?actid=xxx&eid=xxx

返回参数

参数描述取值
errcode错误码int
total_score考卷总分int
max_score最高分int
min_score最低分int
avg_score平均分int
examinee_num考生总数int

例如:

{
    "errcode": 1000,
    "total_score": 123,
    "max_score":123,
    "min_score":123,
    "avg_score":50.0,
    "examinee_num":50
}

重置考试(需要权限)

POST /examination/api/reset_exam

请求参数

参数描述取值
eid考试IDstring
actid频道HashIDstring
uid考生idint
all是否重置所有bool

例如:

{
    "eid": "xxxx",
    "actid": "xxxx",
    "uid": 1,   // 考生ID
    "all": false    // 是否重置所有
}

返回参数

参数描述取值
errcode错误码int

例如:

{
    "errcode": 1000
}

根据ID或名称搜索考试列表(需要权限)

GET /examination/api/search_exams?actid=xxx&term=xxx&status=1&page=xxx&size=xxx

返回参数

参数描述类型描述
actid频道HashIDstring
term考试HashID或考试名称string
status考试状态int0为未开启; 1为已开启; 2为全部状态
page当前页数int
size每页大小int

例如:

返回 200
{
    "errcode": 1000,
    "total_num": 123,
    "total_page": 123,
    "page_num": 123,
    "page_size": 123,
    "result":[
        {
            "eid": "xxx",
            "name": "xxxx",
            "create_at": "2006-01-02 15:04:05", 
            "end_at": "2006-01-02 15:04:05",    // 空值表示始终有效
            "status": 1,   // 1为开始,对应状态使用中; 0为结束,对应状态未使用
            "permanent": true,
            "examinee_num": 123, // 考试人数
            "description": "xxxx",
            "time_limit": 123,  // 考试时长,单位/分钟
            "report_type": 1   // 1为不显示报告,2为仅显示成绩,3为显示所有报告内容
        }
    ]
}

搜索考生考卷(需要权限)

GET /examination/api/search_answer_sheet?actid=xxx&eid=xxx&term=xxx&page=xxx&size=xxx

返回参数

参数描述类型描述
actid频道HashIDstring
eid考试HashIDstring
term考生HashID或考生名称string
page当前页数int
size每页大小int

例如:

返回 200
{
    "errcode": 1000,
    "total_num": 123,
    "total_page": 123,
    "page_num": 123,
    "page_size": 123,
    "result":[
        {
            "sid": "xxx",
            "uid": 123,
            "nick_name": "xxxx",
            "eid": "xxxx",
            "roll_score": 123,
            "total_score": 123,
            "start_at": "2006-01-02 15:04:05",
            "end_at": "2006-01-02 15:04:05",
            "duration": 123,  // 考试用时,单位秒
            "status": 1   // 0为考试中; 1为完成考试,未改卷; 2为已改卷
        }
    ]
}