考试系统

试卷结构

[
    {
        "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":"故乡"
            }
        ]
    }
]

考试系统API接口

创建考试(需要权限)

POST /examination/api/create_exam

请求参数

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

例如:

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

返回参数

参数 描述 取值
errcode 错误码 int

例如:

{
    "errcode": 1000
}

删除考试(需要权限)

POST /examination/api/delete_exam

请求参数

参数 描述 取值
eid 考试ID string

例如:

{
    "eid": "xxxx"
}

返回参数

参数 描述 取值
errcode 错误码 int

例如:

{
    "errcode": 1000
}

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

POST /examination/api/update_exam_basic

请求参数

参数 描述 取值
eid 考试ID string
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 考试ID string
actid 频道HashID string
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 考试ID string
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 考试ID string
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 频道HashID string
eid 考试ID string
status 考试状态 int 0为考试中; 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 答卷ID int
uid 考生ID int
eid 考试ID int
roll_score 卷面分数 int
total_score 试卷总分 int
start_at 开始答卷时间 string
end_at 交卷时间 string
uration 考试用时 int 考试用时,单位秒
status 考试状态 int 0为考试中; 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 答卷ID int
uid 考生ID int
eid 考试ID int
roll_score 卷面分数 int
total_score 考卷总分 int
start_at string
end_at 考试开始时间 string
status 考试结束时间 int 0为考试中; 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 考试ID string
actid 频道HashID string
uid 考生id int
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 频道HashID string
term 考试HashID或考试名称 string
status 考试状态 int 0为未开启; 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 频道HashID string
eid 考试HashID string
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为已改卷
        }
    ]
}
目睹企播 all right reserved,powered by Gitbook修订时间 2020-10-14 08:29:29

results matching ""

    No results matching ""