教师端API——左天衡

//Deprecated Warning: 本Api只关注xiaopiu上的前端代码是否可以实现
//如果可以则实现它,而不考虑其是否是高效率的,方便的甚至是有意义的
//因此大部分时候你都可以更改你认为可以的业务逻辑(前端页面),并更改
//本Api中你认为需要更改的部分。

//Help Yourself!
//(C) CopyRight 1992-2004 All Rights Reserved.

//获取全部课程(需要分页、按照名称查找,按照开课教师查找)
/teacher/course/get-all-courses GET
Request {
    "page": 1,
    "page_length": 10,  //每页显示最大个数
    "course_name": "",
    "teacher_name": ""
}
Response {
    "total_pages": 20,
    "current_page": 1,
    "courses": [
        //由于某些原因,前端页面中的“上次更新”将被废弃并不再可用,这可能是由配置的更改所造成的
        //错误0x0A:数据库中没有必需的字段信息,无法实现该操作
        {
            "course_id" : 1,
            "name" : "数据结构",
            "teacher" : "张三",
            "start_time" : 2003-05-17,
            "end_time" : 2003-08-17,
            "description" : "本课程针对大二学生开设,主要介绍...",
        },{
            "course_id" : 2,
            "name" : "Java程序设计",
            "teacher" : "李四",
            "start_time" : 2003-05-17,
            "end_time" : 2003-08-17,
            "description" : "本课程针对大一学生开设,主要介绍...",
    }]
}

//获取我的课程(需要分页、按照名称查找,按照开课教师查找)
/teacher/course/get-my-courses GET
Request {
    "page": 1,
    "page_length": 10,  //每页显示最大个数
    "course_name": "",
    "teacher_name": ""
}
Response {
    "total_pages": 10,
    "current_page": 1,
    "courses":[
        //由于某些原因,前端页面中的“上次更新”将被废弃并不再可用,这可能是由配置的更改所造成的
        //错误0x0A:数据库中没有必需的字段信息,无法实现该操作
        {
            "course_id" : 1,
            "name" : "数据结构",
            "teacher" : "张三",
            "start_time" : 2003-05-17 12:00,
            "end_time" : 2003-08-17 12:00,
            "description" : "本课程针对大二学生开设,主要介绍...",
        },{
            "course_id" : 2,
            "name" : "算法导论",
            "teacher" : "张三",
            "start_time" : 2003-05-17 12:00,
            "end_time" : 2003-08-17 12:00,
            "description" : "本课程针对大二学生开设,主要介绍...",
    }]
}

//获取我的当前课程(不需要分页)即现在时间介于该课程开始时间和结束时间之间的课程
/teacher/course/get-my-current-courses GET
Request {

}
Response {
    "courses":[
        {
            "course_id" : 1,
            "name" : "数据结构",
            "teacher" : "张三",
            "start_time" : 2003-05-17 12:00,
            "end_time" : 2003-08-17 12:00,
            "description" : "本课程针对大二学生开设,主要介绍...",
        },{
            "course_id" : 2,
            "name" : "算法导论",
            "teacher" : "张三",
            "start_time" : 2003-05-17 12:00,
            "end_time" : 2003-08-17 12:00,
            "description" : "本课程针对大二学生开设,主要介绍...",
    }]
}

//手动增加一门课程
/teacher/course/add-course POST
Request {
    "name" : "数据结构",
    "teacher" : "张三",
    "start_time" : 2003-05-17 12:00,
    "end_time" : 2003-08-17 12:00,
    "description" : "本课程针对大二学生开设,主要介绍...",
}
Response {
    //在新建成功时返回200,否则返回具体错误code并且更新error_msg
    "error_msg" : "",
    
    //如果发生错误则不存在以下内容,因此前端应该先执行检查
    //事实上,前端在获取到任何后端数据时都应先检查是否为200
    "course_id" : 14,
}

//编辑一门课程
/teacher/course/edit-course POST
Request {
    "course_id" : 14,
    "name" : "数据结构",
    "teacher" : "张三",
    "start_time" : 2003-05-17 12:00,
    "end_time" : 2003-08-17 12:00,
    "description" : "本课程针对大二学生开设,主要介绍...",
}
Response {
    //在编辑成功时返回200,否则返回具体错误code并且更新error_msg
    "error_msg" : "",
}

//复制一门课程
/teacher/course/duplicate-course POST
Request {
    "course_id" : 14,
}
Response {
    //在复制成功时返回200,否则返回具体错误code并且更新error_msg
    "error_msg" : "",
    
    //如果发生错误则不存在以下内容,因此前端应该先执行检查
    //事实上,前端在获取到任何后端数据时都应先检查是否为200
    "course_id" : 15,   
}

//删除一门课程
/teacher/course/delete-course POST
Request {
    "course_id" : 14,
}
Response {
    //在删除成功时返回200,否则返回具体错误code并且更新error_msg
    "error_msg" : "",
}

//获取我的某个课程的所有课时(需要分页,按照名称查找)
/teacher/lecture/get-my-lectures GET
Request {
    "page": 1,
    "page_length": 10,  //每页显示最大个数
    "lecture_name": "",
    "course_id" : 1,
}
Response{
    "total_pages": 10,
    "current_page": 1,
    "lectures":[
        {
            "lecture_id" : 1,
            "name" : "lecture1"
        },{
            "lecture_id" : 2,
            "name" : "lecture2"
        }]
}

//获取我的某个课程的所有实验(需要分页,按照名称查找)
/teacher/lab/get-my-labs GET
Request {
    "page": 1,
    "page_length": 10,  //每页显示最大个数
    "lab_name": "",
    "course_id" : 1,
}
Response{
    "total_pages": 10,
    "current_page": 1,
    "labs":[
        {
            "lab_id" : 1,
            "name" : "二叉搜索树"
        },{
            "lab_id" : 2,
            "name" : "B树和B+树"
        }]
}

//获取我的某个课程的所有考试(需要分页,按照名称查找)
/teacher/exam/get-my-exams GET
Request {
    "page": 1,
    "page_length": 10,  //每页显示最大个数
    "exam_name": "",
    "course_id" : 1,
}
Response{
    "total_pages": 1,
    "current_page": 1,
    "exams":[
        {
            "exam_id" : 1,
            "name" : "期中考试",
            "start_time" : 2003-08-15 12:00,
            "end_time": 2003-08-15 15:00,
            "description": "请遵守考试纪律"
        },{
            "exam_id" : 2,
            "name" : "期末考试"
            "start_time" : 2003-09-15 12:00,
            "end_time": 2003-09-15 15:00,
            "description": "请遵守考试纪律"
        }]
}

//获取我的某个课程的所有学生(需要分页,按照学号查找,按照姓名查找)
/teacher/course/get-my-students GET
Request {
    "page": 1,
    "page_length": 10,  //每页显示最大个数
    "student_number": "1612",
    "student_name": "",
    "course_id" : 1,
}
Response{
    "total_pages": 10,
    "current_page": 1,
    "students":[
        {
            "student_id" : 1,
            "student_number" : "1612000",
            "student_name" : "王五"
        },{
            "student_id" : 2,
            "student_number" : "1612000",
            "student_name" : "赵六"
        }]
}

//删除学生
/teacher/course/delete-my-student POST
Request {
    "student_id": 1
}
Response{
    //在删除成功时返回200,否则返回具体错误code并且更新error_msg
    "error_msg" : ""
}

//新建课时
/teacher/lecture/create-lecture POST
Request {
    "course_id" : 1,
    "name" : "二叉树的搜索",
    "description" : "主要介绍二叉树的递归和非递归搜索方式。"
}
Response{
    //在新建成功时返回200,否则返回具体错误code并且更新error_msg
    "error_msg" : ""
    
    //如果发生错误则不存在以下内容,因此前端应该先执行检查
    //事实上,前端在获取到任何后端数据时都应先检查是否为200
    "lecture_id" : 10
}

//编辑课时
/teacher/lecture/edit-lecture POST
Request {
    "lecture_id" : 1,
    "name" : "二叉树的先序遍历搜索",
    "description" : "主要介绍二叉树的先序遍历搜索方式。"
}
Response{
    //在编辑成功时返回200,否则返回具体错误code并且更新error_msg
    "error_msg" : ""
}

//获取某个课时的信息
/teacher/lecture/get-lecture GET
Request {
    "lecture_id" : 1,   
}
Response{
    "name" : "二叉树的先序遍历搜索",
    "description" : "主要介绍二叉树的先序遍历搜索方式。"
}

//获取某个课时的练习题
/teacher/lecture/get-problems GET
Request {
    "lecture_id" : 1,   
}
Response{
    "problems":[
        {
            "problem_id" : 1,
            "problem_name" : "猴子吃桃问题",
        },{
            "problem_id" : 2,
            "problem_name" : "A + B问题",
        }]
}

//修改某个课时的练习题
//如果原先没有练习题 则可以理解为新建某个课时的练习题
/teacher/lecture/edit-problems POST
Request {
    "lecture_id" : 1,
    "problem_ids":[
        {
            "problem_id" : 1
        }, {
            "problem_id" : 3
        }]
}
Response{
    //在编辑成功时返回200,否则返回具体错误code并且更新error_msg
    "error_msg" : ""
}


//添加某个课时的课件
/teacher/lecture/add-file POST(FILE)
Request {
    "lecture_id" : 1,
    "filename" : "二叉树先序遍历课件.pptx",
    "file": [文件信息]########[文件信息]
}
Response{
    //在添加成功时返回200,否则返回具体错误code并且更新error_msg
    "error_msg" : ""
}

//删除某个课时的课件
/teacher/lecture/delete-file POST
Request {
    "lecture_id" : 1,
    "filename" : "二叉树先序遍历课件.pptx"
}
Response{
    //在删除成功时返回200,否则返回具体错误code并且更新error_msg
    "error_msg" : ""
}

//获取某个课时的全部题目的提交统计(需要分页)
/teacher/lecture/get-all-problems-submissions GET
Request {
    "page": 1,
    "page_length": 10,  //每页显示最大个数
    "lecture_id" : 1
}
Response {
    "total_pages": 10,
    "current_page": 1,
    "submissions":[
        {
            "problem_id" : 1,
            "problem_name" : "猴子吃桃问题",
            //可根据业务逻辑调整
            "submissions_count" : 100,
            "TLEsubmissions_count" : 50,
            "WAsubmissions_count": 30,
            "ACsubmissions_count": 20
        },{
            "problem_id" : 1,
            "problem_name" : "A + B问题",
            //可根据业务逻辑调整
            "submissions_count" : 100,
            "TLEsubmissions_count" : 0,
            "WAsubmissions_count": 10,
            "ACsubmissions_count": 90
    }]
}

//获取某个题目的所有提交(需要分页,按照学号查找,按照状态查找)
/teacher/problem/get-all-submissions GET
Request {
    "page": 1,
    "page_length": 10,  //每页显示最大个数
    "student_number": "1612",
    "status": NULL,
    "problem_id" : 1,
}
Response{
    "total_pages": 10,
    "current_page": 1,
    "submissions":[
        //由于某些原因,前端页面中的“查重率”将被废弃并不再可用,这可能是由配置的更改所造成的
        //错误0x0A:数据库中没有必需的字段信息,无法实现该操作

        //由于某些原因:前端页面中的“按照状态查找”已被替换为以下枚举类型: ALL_Passed NOT_ALL_Passed NULL
        //错误0x0C:无法对多个变量定义统一的代表属性
        {
            "submission_id" : 1,
            "problem_id" : 1,
            "student_id" : 1,
            "student_number" : "1612000",
            "created_time" : 2003-08-17 15:00,
            "succeed_cases_count" : 3,
            "all_cases_count" : 5,
            "language_id": 1,
        },{
            "submission_id" : 2,
            "problem_id" : 1,
            "student_id" : 3,
            "student_number" : "1612001",
            "created_time" : 2003-08-17 16:20,
            "succeed_cases_count" : 5,
            "all_cases_count" : 5
            "language_id": 2,
        }]
}

//新建实验
/teacher/lab/create-lab POST
Request {
    "course_id" : 1,
    "name" : "二叉树的搜索",
    "description" : "实验练习二叉树的搜索。",
    "start_time" : 2007-06-15,
    "end_time" : 2007-06-26,
    "report_required" : false
}
Response{
    //在新建成功时返回200,否则返回具体错误code并且更新error_msg
    "error_msg" : ""
    
    //如果发生错误则不存在以下内容,因此前端应该先执行检查
    //事实上,前端在获取到任何后端数据时都应先检查是否为200
    "lab_id" : 10
}

//编辑实验
/teacher/lab/edit-lab POST
Request {
    "lab_id" : 1,
    "name" : "二叉树的先序遍历搜索",
    "description" : "实验练习二叉树的先序遍历搜索。",
    "start_time" : 2007-06-25,
    "end_time" : 2007-06-30,
    "report_required" : true
}
Response{
    //在编辑成功时返回200,否则返回具体错误code并且更新error_msg
    "error_msg" : ""
}

//获取某个实验的信息
/teacher/lab/get-lab GET
Request {
    "lab_id" : 1,   
}
Response{
    "name" : "二叉树的先序遍历搜索",
    "description" : "主要介绍二叉树的先序遍历搜索方式。"
    "start_time" : 2007-06-25,
    "end_time" : 2007-06-30,
    "report_required" : true
}

//获取某个实验的作业题
/teacher/lab/get-problems GET
Request {
    "lab_id" : 1,   
}
Response{
    "problems":[
        {
            "problem_id" : 1,
            "problem_name" : "猴子吃桃问题",
        },{
            "problem_id" : 2,
            "problem_name" : "A + B问题",
        }]
}

//修改某个实验的练习题
//如果原先没有练习题 则可以理解为新建某个实验的练习题
/teacher/lab/edit-problems POST
Request {
    "lab_id" : 1,
    "problem_ids":[
        {
            "problem_id" : 1
        }, {
            "problem_id" : 3
        }]
}
Response{
    //在编辑成功时返回200,否则返回具体错误code并且更新error_msg
    "error_msg" : ""
}


//添加某个实验的课件
/teacher/lab/add-file POST(FILE)
Request {
    "lab_id" : 1,
    "filename" : "二叉树先序遍历实验要求.pptx",
    "file": [文件信息]########[文件信息]
}
Response{
    //在添加成功时返回200,否则返回具体错误code并且更新error_msg
    "error_msg" : ""
}

//删除某个实验的课件
/teacher/lab/delete-file POST
Request {
    "lab_id" : 1,
    "filename" : "二叉树先序遍历实验要求.pptx"
}
Response{
    //在删除成功时返回200,否则返回具体错误code并且更新error_msg
    "error_msg" : ""
}

//获取某次实验的全部提交(需要分页,按照学号查找,按照姓名查找)
/teacher/lab/get-all-submissions GET
Request {
    "page": 1,
    "page_length": 10,  //每页显示最大个数
    "lab_id" : 1,
    "student_number" : "",
    "student_name" : ""
}
Response{
    "total_pages": 10,
    "current_page": 1,
    "submissions" : [
        {
            "submission_id" : 101,
            "student_id" : 1,
            "attachment_grade" : 90,
            "problem_grade" : 100
        }, {
            "submission_id" : 102,
            "student_id" : 2,
            "attachment_grade" : 60,
            "problem_grade" : 60
        }]
}

//获取某次实验提交的具体信息
/teacher/lab/get-submission GET
Request {
    "submission_id" : 101
}
Response{
    "student_id": 1,
    "student_number" : 1612000,
    "student_name": "赵六",
    "problem_submission_id": 1001,
    "attachments" : [
        {
            "attachment_id" : 10,
            "attachment_name" : "实验报告1612000.pdf",
        }, {
            "attachment_id" : 20,
            "attachment_name" : "实验报告2.pdf",
        }]
}

//下载某个实验的某个课件
/teacher/lab/get-submission-file GET
Request {
    "attachment_id" : 10
}
Response{
    "file": [文件信息]########[文件信息]
}

//获取某个题目的一次提交的详细信息
/teacher/submission/get-submission GET
Request {
    "submission_id" : 1001
}
Response{
    "id_problem" : 1,
    "id_student" : 1,
    "code" : "import java.util.*; \n public class Main{ \n public static void main(String []args...",
    "created_at" 2007-08-16,
    "runtime" : 993ms,
    "language_id" : 1,
    "memory" : 1036,
    "IP" : "10.0.0.91",
    "succeed_cases_count" : 5,
    "all_cases_count" : 5
}

//获取题库中的所有题目(需要分页,按照课程名查找,按照创建人查找,按照名称查找
/teacher/problem/get-all-problems GET
Request {
    "page": 1,
    "page_length": 10,  //每页显示最大个数
    "program_name": "",
    "created_teacher_name" : "",
    "course_name" : ""
}
Response{
    "total_pages": 10,
    "current_page": 1,
    "problems": [
        {
            "problem_id" : 1,
            "problem_name" : "猴子吃桃问题",
            "created_teacher_id" : 1,
            "created_time" : 2007-06-13 14:00,
            "submit_count" : 80,
            "accepted_count" : 10
        }, {
            "problem_id" : 2,
            "problem_name" : "A + B问题",
            "created_teacher_id" : 1,
            "created_time" : 2007-06-13 13:00,
            "submit_count" : 100,
            "accepted_count" : 90
        }]
}

//获取一个题目的详细信息
/teacher/problem/get-problem GET
Request {
    "problem_id": 1,
}
Response{
    "problem_name" : "猴子吃桃问题",
    "description": "有m个猴子,n个桃子,请设计一种算法,使得..."
    "created_teacher_id" : 1,
    "created_time" : 2007-06-13 14:00,
    "modified_time" : 2007-06-13 15:00,
    "runtime_limit" : 1024,
    "memory_limit" : 1024,
    "tags":[{
        "tag_id" : 1,
        "tag_name" : "贪心"
        }, {
        "tag_id" : 2,
        "tag_name" : "动态规划"
        }]
    "cases":[{
        "case_id" : 1001,
        "input" : "2, 3, 4",
        "output" : "5"
        "tags":[{
            "tag_id" : 1,
            "tag_name" : "数组越界检查"
            }, {
            "tag_id" : 2,
            "tag_name" : "除零错检查"
            }]
        }, {
        "case_id" : 1002,
        "input" : "2, 3, 0",
        "output" : "0"
        "tags":[{
            "tag_id" : 2,
            "tag_name" : "除零错检查"
            }, {
            "tag_id" : 3,
            "tag_name" : "栈溢出检查"
        }]
    ]
}

//新建一道题目
/teacher/problem/create-problem POST
Request {
    "problem_name" : "猴子吃桃问题",
    "description": "有m个猴子,n个桃子,请设计一种算法,使得..."
    "created_teacher_id" : 1,
    "runtime_limit" : 1024,
    "memory_limit" : 1024,
    "tags":[{
        "tag_id" : 1,
        "tag_name" : "贪心"
        }, {
        "tag_id" : 2,
        "tag_name" : "动态规划"
        }]
    "cases":[{
        "case_id" : 1001,
        "input" : "2, 3, 4",
        "output" : "5"
        "tags":[{
            "tag_id" : 1,
            "tag_name" : "数组越界检查"
            }, {
            "tag_id" : 2,
            "tag_name" : "除零错检查"
            }]
        }, {
        "case_id" : 1002,
        "input" : "2, 3, 0",
        "output" : "0"
        "tags":[{
            "tag_id" : 2,
            "tag_name" : "除零错检查"
            }, {
            "tag_id" : 3,
            "tag_name" : "栈溢出检查"
        }]
    ]
}
Response{
    //在新建成功时返回200,否则返回具体错误code并且更新error_msg
    "error_msg" : ""
    
    //如果发生错误则不存在以下内容,因此前端应该先执行检查
    //事实上,前端在获取到任何后端数据时都应先检查是否为200
    "problem_id" : 3
}

//编辑一道题目
/teacher/problem/edit-problem POST
Request {
    "problem_id" : 3,
    "problem_name" : "猴子吃桃问题",
    "description": "有m个猴子,n个桃子,请设计一种算法,使得..."
    "created_teacher_id" : 1,
    "runtime_limit" : 1024,
    "memory_limit" : 1024,
    "tags":[{
        "tag_id" : 1,
        "tag_name" : "贪心"
        }, {
        "tag_id" : 2,
        "tag_name" : "动态规划"
        }]
    "cases":[{
        "case_id" : 1001,
        "input" : "2, 3, 4",
        "output" : "5"
        "tags":[{
            "tag_id" : 1,
            "tag_name" : "数组越界检查"
            }, {
            "tag_id" : 2,
            "tag_name" : "除零错检查"
            }]
        }, {
        "case_id" : 1002,
        "input" : "2, 3, 0",
        "output" : "0"
        "tags":[{
            "tag_id" : 2,
            "tag_name" : "除零错检查"
            }, {
            "tag_id" : 3,
            "tag_name" : "栈溢出检查"
        }]
    ]
}
Response{
    //在编辑成功时返回200,否则返回具体错误code并且更新error_msg
    "error_msg" : ""
}

//查看一定时间段的所有题目提交(需要分页,按开始/结束时间查找,按题目id查找,按学生姓名查找)
/teacher/submission/get-all-submissions POST
Request {
    "page": 1,
    "page_length": 10,  //每页显示最大个数
    //为空表示最早时间
    "begin_time":2007-06-17 15:00,
    //为空表示最晚时间
    "end_time":2007-06-17 15:00,
    "program_id": "",
    "student_name": "张三",
}
Response{
    "total_pages": 10,
    "current_page": 1,
    "submissions": [
        {
            "submission_id" : 1,
            "problem_id" : 1,
            "student_id" : 1,
            "student_number" : "1612000",
            "student_name": "张三",
            "created_time" : 2003-08-17 15:00,
            "succeed_cases_count" : 3,
            "all_cases_count" : 5,
            "language_id": 1
        }, {
            "submission_id" : 2,
            "problem_id" : 1,
            "student_id" : 1,
            "student_number" : "1612000",
            "student_name": "张三",
            "created_time" : 2003-08-17 16:00,
            "succeed_cases_count" : 5,
            "all_cases_count" : 5,
            "language_id": 1
        }]
}

//获取自己的个人信息
/teacher/information/get-information GET
Request {
}
Response {
    "teacher_id" : 1,
    "name" : "张三",
    "email" : "zhangsan@gmail.com",
    "gender_id" : 0,
}

//修改自己的个人信息
/teacher/information/edit-information POST
Request {
    "teacher_id" : 1,
    "password" : "*******",
    "name" : "张三",
    "email" : "zhangsan@gmail.com",
    "gender_id" : 0,
}
Response {
    //在编辑成功时返回200,否则返回具体错误code并且更新error_msg
    "error_msg" : ""
}


//增加一个题目标签
/teacher/problem/add-tag POST
Request {
  "tag_name" : "贪心算法"
}
Response {
  //在新建成功时返回200,否则返回具体错误code并且更新error_msg
  "error_msg" : "",

  //如果发生错误则不存在以下内容,因此前端应该先执行检查
  //事实上,前端在获取到任何后端数据时都应先检查是否为200
  //典型的错误应该是:该标签已经存在
  "tag_id" : 4,
}

 

posted @ 2019-05-15 14:13  cs_Sunday  阅读(325)  评论(0编辑  收藏  举报