avatar

目录
水木火课堂API文档
域名暂时为: thunderclass.mr-lin.site

关于token:在一些请求中要在请求头的Authorization带上token信息。token分为两种,access token与refresh token, access token 的过期时间为七天,refresh token的过期时间为一个月,若access token 已过期我会根据refresh token发送生成新的token并伴随原请求一起返回,返回示例

Code
1
2
3
4
5
6
7
8
9
10
11
{
"status": 200,
"message": "succeed",
"data": {原请求应返回的数据},
"token": {
"access_token": access_token,
"refresh_token": refresh_token,
"expires_access": 3600*24*7,
"expires_refresh": 3600*24*30
}
}

所以这就可能需要你在每次数据返回时判断是否一起返回了token信息。(要是嫌麻烦的话可以先不搞,照常发送token就好了(反正评委也不知道))

tips

1.统一在请求url前面加一个/api,比如原请求url为 /user/current 实际请求URL为 /api/user/current

2.对于同一类型的资源(比如用户信息就是一类资源),可能在文档里有的接口该类资源有返回某一数据而在另一个接口里面没有返回该数据,这纯粹是因为我懒得更新文档

3.文档里面所有的时间戳都已经变成格式化时间,但是文档我没有更新。但是有些地方可能有遗漏orz

4.返回的任务和课程数据都加了一个time_excess数据,表示是否在资源开放时间内

[TOC]

有关认证与用户

判断token是否合法

请求url:/auth/token

请求方法:GET

返回数据:

bash
1
2
3
4
5
{
"status": 200,
"message": "OK" or "Bad Token",
"data": ""
}

用户注册

1.发送验证码:

请求方式

请求方法:POST

请求URL:http://sms.mr-lin.site/thunderclass?tel=&type=

请求参数:

请求参数 必须 类型 说明
type int [‘signup’, ‘login’, ‘changeTel’, ‘changePassword’, ‘delAccount’]
tel string

上面的type,比如用户是要发送修改密码的验证码,因为changePassword对应的下标为3,所以type应该为3

返回示例

无返回

2.验证电话号码是否已注册

请求方式

请求方法:GET

请求URL:/check/telephone?tel=

请求参数:无

返回示例
Code
1
2
3
{
"status": 1 # or 0
}

3.验证用户名是否已注册

请求方式

请求方法:GET

请求URL:/check/nickname?nickname=

请求参数:无

放回示例
bash
1
2
3
{
"status": 1 # or 0
}

4.发送注册信息

请求方式

请求方法:POST

请求URL:/user/current

请求参数:

请求参数 必须 类型 说明
nickname 1 str
telephone 1 str
password 1 str
code 1 str
返回示例
bash
1
2
3
4
5
6
7
8
9
10
11
12
13
data = {
"self": "/user/1",
"uid": 1,
"nickname": "lin",
"gender": "male",
"school": "fzu", or null
"name": "lin wei", or null
"school_id": "031902321", or null
"telephone": 8888888,
"grade": "2019级", or null
"class": "计3", or null
"courses": [ ]
}

用户登录

1.密码登录

请求方式

请求方式:POST

请求URL:/login?method=0

请求参数:

请求参数 必须 类型 说明
username 1 str 用户名电话皆可
password 1 str

2.验证码登录

请求方式

请求方式:POST

请求URL:/login?method=1

请求参数:

请求参数 必须 类型 说明
tel 1 str
code 1 str
返回示例
bash
1
2
3
4
5
6
7
{	
'user_info': 用户信息,
'access_token': access_token,
'refresh_token': refresh_token,
'access_expires': 3600*24*7,
'refresh_expires': 3600*24*30
}

简化用户信息

请求方式

请求方法:GET

请求URL:user/int:uid

请求参数:无

返回示例
bash
1
2
3
4
5
6
7
8
data = {
"self": "user/1",
"uid": 1,
"nickname": "lin",
"gender": "male",
"avatar": 用户头像url,
"school": "fzu", or null
}

说明:无需token

当前用户接口

需要token

获取用户信息

请求方式

请求方法:GET

请求URL:/user/current

请求参数:无

返回示例
bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
data = {
"self": "/user/1",
"uid": 1,
"nickname": "lin",
"gender": "male",
"avatar": 用户头像url,
"school": "fzu", or null
"name": "lin wei", or null
"school_id": "031902321", or null
"telephone": 8888888,
"grade": "2019级", or null
"class": "计3", or null
"courses": [ ]
}

修改用户信息

请求方式

请求方法:PUT

请求URL:/user/current

请求参数:

请求参数 必须 类型 说明
nickname 0 str 先验证一下用户名是否已存在吧
gender 0 str male or female
telephone 0 str
code_changeTel 0 str 若修改电话,必须
password 0 str
code_changePassword 0 str 若修改密码,必须
返回示例
bash
1
2
3
4
5
6
7
8
9
10
11
12
13
data = {
"self": "/user/1",
"uid": 1,
"nickname": "lin",
"gender": "male",
"school": "fzu", or null
"name": "lin wei", or null
"school_id": "031902321", or null
"telephone": 8888888,
"grade": "2019级", or null
"class": "计3", or null
"courses": [ ]
}

删除用户

请求方式

请求方法:DELETE

请求URL:user/current

请求参数:

请求参数 必须 类型 说明
code 1 str
返回示例:

获取用户作业列表

请求方式

请求方法:GET

请求URL:/user/current/tasks

请求参数:无

返回示例
bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{
"data": {
"count": 1,
"tasks": [
{
"answer_visible": true,
"create_at": "2020.06.14 22:38:19",
"finished": false,
"id": "64a0b6fc-ea47-4918-86b8-7ac54f4a05b1",
"max_score": 280,
"self": "http://127.0.0.1:5000/api/task/64a0b6fc-ea47-4918-86b8-7ac54f4a05b1",
"task_name": "test_task",
"time_begin": "2020.06.14 11:11:46",
"time_end": "2020.10.08 04:58:26",
"time_excess": false, # 是否已超时
"type": "test"
}
]
},
"message": "succeed",
"status": 200
}

用户个人信息认证

请求方式

请求方法:POST

请求URL:/user/current/certificate

请求参数:

请求参数 必须 类型 说明
school 1 str
student_id 1 str
certificate_code 1 str
返回示例
bash
1
2
3
4
5
6
7
8
9
10
11
12
13
data = {
"self": "/user/1",
"uid": 1,
"nickname": "lin",
"gender": "male",
"school": "fzu", or null
"name": "lin wei", or null
"school_id": "031902321", or null
"telephone": 8888888,
"grade": "2019级", or null
"class": "计3", or null
"courses": [ ]
}

有关课程

课程列表

创建课程

请求方式

请求方法:POST

请求URL:course/course_list

请求参数:

请求参数 必须 类型 说明
name str
public str
introduce str
start_at 时间戳
end_at 时间戳
返回示例
bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{
"data": {
"avatar": null, # url
"end_at": "2020.10.08 16:13:27",
"id": 1,
"introduce": "test_course2",
"name": "test_course2",
"public": false,
"self": "http://127.0.0.1:5000/api/course/1",
"stat_at": "2020.06.14 22:26:47",
"teacher": {
"avatar": "http://cdn.mr-lin.site/banner/banner13.jpg",
"gender": "secret",
"introduce": null,
"nickname": "3927",
"school": null,
"self": "http://127.0.0.1:5000/api/user/1",
"uid": 1
},
"teacher_name": "3927",
"time_excess": false # 是否在进行时间内
},
"message": "succeed",
"status": 200
}

获取课程列表

返回所有公开课信息,可通过teacher_id参数查询特点教师课程(虽然感觉没什么用)

请求方式

请求方法:GET

请求URL:/course/course_list [ ?teacher_id=int:uid ]

请求参数:无

返回示例
bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{
"data": {
"count": 2,
"courses": [
{
"id": 2,
"introduce": "test_course1",
"name": "test_course1",
"public": true,
"avatar": 课程头像url,
"self": "http://127.0.0.1:5000/course/2",
"teacher_name": "3927"
},
{
"id": 4,
"introduce": "test_unpublic_course",
"name": "test_course_public",
"public": true,
"avatar": 课程头像url,
"self": "http://127.0.0.1:5000/course/4",
"teacher_name": "3927"
}
],
"self": "http://127.0.0.1:5000http://127.0.0.1:5000/course/course_list"
},
"message": "succeed",
"status": 200
}

教师获取课程列表

请求方式

请求方法:GET

请求URL:/user/teacher/current/courses

请求参数:无

返回示例
bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{
"data": {
"count": 2,
"courses": [
{
"avatar": null,
"id": 1,
"introduce": "test_course2",
"name": "test_course2",
"public": false,
"self": "http://127.0.0.1:5000/course/1",
"teacher_name": "3927"
},
{
"avatar": null,
"id": 2,
"introduce": "test_course1",
"name": "test_course1",
"public": true,
"self": "http://127.0.0.1:5000/course/2",
"teacher_name": "3927"
}
],
"self": "http://127.0.0.1:5000http://127.0.0.1:5000/user/teacher/current/courses"
},
"message": "succeed",
"status": 200
}

单个课程

获取课程

请求方式

请求方法:GET
请求URL:/course/int:id

请求参数:无

返回示例
bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{
"data": {
"avatar": null,
"end_at": "2020.10.08 16:13:27",
"id": 1,
"introduce": "test_course2",
"name": "test_course2",
"public": false,
"self": "http://127.0.0.1:5000/api/course/1",
"stat_at": "2020.06.14 22:26:47",
"teacher": {
"avatar": "http://cdn.mr-lin.site/banner/banner13.jpg",
"gender": "secret",
"introduce": null,
"nickname": "3927",
"school": null,
"self": "http://127.0.0.1:5000/api/user/1",
"uid": 1
},
"teacher_name": "3927",
"time_excess": false # 是否在进行时间内
},
"message": "succeed",
"status": 200
}

修改课程信息

请求方式

请求方法:PUT
请求URL:/course/int:id

请求参数:

请求参数 必须 类型 说明
introduce str
返回示例
bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{
"self": "http://127.0.0.1:5000/course/2",
"id": 2,
"name": "test_course1",
"introduce": "edit introduce",
"public": true,
"teacher_name": "3927",
"teacher": {
"self": "http://127.0.0.1:5000/user/1",
"uid": 1,
"nickname": "3927",
"introduce": null,
"gender": "secret",
"school": null
}
}

删除课程

请求方式

请求方法:DELETE
请求URL:/course/int:id

请求参数:无

返回示例
bash
1
2
3
4
5
{
"data": {},
"message": "succeed",
"status": 200
}

课程作业

获取课程作业列表

请求方式

请求方法:GET

请求URL:/course/int:course_id/tasks?per_page=&page=&type=<test/exam> # type没有则返回所有作业

请求参数:无

per_page默认为20,page默认为1

返回示例
bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{
"data": {
"count": 1, #当前页面任务数量
"has_next": true, #是否有下一页
"has_prev": true,
"max_page": 4, #最大页数
"next_page": "http://127.0.0.1:5000/course/1/tasks?per_page=1&page=3", #下一页url
"prev_page": "http://127.0.0.1:5000/course/1/tasks?per_page=1&page=1",
"tasks": [ # 任务信息
{
"answer_visible": true,
"create_at": 1592114474.9901924,
"finished": false,
"id": "5a7a677b-b0fa-4725-9a40-578459573bfb",
"max_score": 280,
"self": "http://127.0.0.1:5000/task/5a7a677b-b0fa-4725-9a40-578459573bfb",
"task_name": "test_task",
"statistic_blank": {
"count": 1, # 题数
"sum": 5 # 分值
},
"statistic_select": {
"count": 1,
"sum": 5
},
"statistic_subjective": {
"count": 3,
"sum": 270
},
"time_begin": 1592104306.7411063,
"time_end": 1602104306.7411063,
"time_excess": false, # 是否超时
"type": "test"
}
]
},
"message": "succeed",
"status": 200
}

创建新作业

请求方式

请求方法:POST

请求URL:/course/int:course_id/tasks

请求参数:

请求参数 必须 类型 说明
type (“test”, “exam”) 选一个
t_begin 时间戳 开始时间
t_end 时间戳 截至时间
name str 作业名称
ans_visible 0 or 1 答案是否可见
problems list 问题
problem + order file 对应题号的文件

每个problem所需要参数:

请求参数 必须 类型 说明
type (“select”, “blank”, “subjective”) 选一个
content 若为选择题,则为一个包含text与options的字典,否则为一个字符串
answer 选择填空必须 列表(论述题为字符串)
answer_detail str
max_score int 分值
order int 题号
返回示例
bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
{
"data": {
"answer_visible": true,
"create_at": 1591629131.3280947,
"finished": false,
"id": "a94939d0-2ee7-4f8b-be90-c7c18c939171", # 作业id
"max_score": 190,
"problems": [
{
"content": {
"options": [
"选项A",
"选项B",
"选项C"
],
"text": "选择题文本(可为空)"
},
"create_at": 1591629131.3290923,
"id": "f068b895-dc58-4f2e-a074-61522e46a6fe",
"max_score": 5,
"medias": [],
"order": 1,
"type": "select"
},
{
"content": "the answer for 2333 is ___",
"create_at": 1591629131.33009,
"id": "194c37a9-6453-4c73-a9ed-bbd2e2f3d94b",
"max_score": 5,
"medias": [],
"order": 2,
"type": "blank"
},
{
"content": "how to make a girl friend",
"create_at": 1591629131.33009,
"id": "468cb756-8ce8-4912-ac7f-a9fd8ed8abc3",
"max_score": 90,
"medias": [],
"order": 3,
"type": "subjective"
},
{
"content": null,
"create_at": 1591629131.3310876,
"id": "146c283b-0739-464a-b0fa-91bb01721a21",
"max_score": 90,
"medias": [ # 教师上传的媒体文件
{
"name": "76b559fd-ef09-4090-aa7c-fa475819f4da",
"type": "python",
"upload_at": 1591629131.3151295,
"url": "/files/problem/76b559fd-ef09-4090-aa7c-fa475819f4da.py",
"uuid": "76b559fd-ef09-4090-aa7c-fa475819f4da"
},
{
"name": "264a9689-2c03-4e24-bf36-89ed3ba71195",
"type": "python",
"upload_at": 1591629131.3151295,
"url": "/files/problem/264a9689-2c03-4e24-bf36-89ed3ba71195.py",
"uuid": "264a9689-2c03-4e24-bf36-89ed3ba71195"
},
{
"name": "cd33661d-6113-4d38-bf82-f0e3660521d6",
"type": "excel",
"upload_at": 1591629131.3151295,
"url": "/files/problem/cd33661d-6113-4d38-bf82-f0e3660521d6.xls",
"uuid": "cd33661d-6113-4d38-bf82-f0e3660521d6"
}
],
"order": 4,
"type": "subjective"
}
],
"self": "http://127.0.0.1:5000/task/a94939d0-2ee7-4f8b-be90-c7c18c939171",
"task_name": "test_task",
"statistic_blank": {
"count": 1,
"sum": 5
},
"statistic_select": {
"count": 1,
"sum": 5
},
"statistic_subjective": {
"count": 3,
"sum": 270
},
"time_begin": 1591526227.6053202,
"time_end": 1591526228.775193,
"type": "test"
},
"message": "succeed",
"status": 200
}

课程学生信息

获取课程所有学生信息

请求方式

请求方法:GET

请求URL:/course/int:course_id/students?page=&per_page=

请求参数:无

返回示例
bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{
"data": {
"count": 1,
"students": [
{
"gender": "secret",
"introduce": null,
"nickname": "lin",
"school": null,
"self": "http://127.0.0.1:5000/user/2",
"uid": 2
}
]
},
"message": "succeed",
"status": 200
}

导入学生名单

请求方式

请求方法:POST

请求URL:/courses/int:course_id/students/import

请求参数:

请求参数 必须 类型 说明
excel_file file 至少需要学校,姓名,学号绑定码四个信息,还可以有年级与班级两项信息
返回示例
bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{  # 返回课程信息
"data": {
"id": 1,
"introduce": "test_course2",
"name": "test_course2",
"public": false,
"self": "http://127.0.0.1:5000/course/1",
"teacher": {
"gender": "secret",
"introduce": null,
"nickname": "3927",
"school": null,
"self": "http://127.0.0.1:5000/user/1",
"uid": 1
},
"teacher_name": "3927"
},
"message": "succeed",
"status": 200
}

加入课程

只能通过该方式加入公开课

请求方式

请求方法:POST

请求URL:/course/int:course_id/join

请求参数:无

返回示例
bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{  # 返回课程信息
"data": {
"id": 1,
"introduce": "test_course2",
"name": "test_course2",
"public": true,
"self": "http://127.0.0.1:5000/course/1",
"teacher": {
"gender": "secret",
"introduce": null,
"nickname": "3927",
"school": null,
"self": "http://127.0.0.1:5000/user/1",
"uid": 2
},
"teacher_name": "3927"
},
"message": "succeed",
"status": 200
}

查看加入课程状态

请求方式

请求方法:GET

请求URL:/course/int:cid/join/status

请求参数:无

返回示例
bash
1
2
3
4
5
{
"status": 200,
"message": "succeed",
"data": 1
}

章节及其文件信息

获取课程章节列表

请求方式

请求方法:GET

请求URL:/course/int:cid/chapters

请求参数:无

返回示例
bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{
"data": {
"chapters": [
{
"create_at": 1591630551.3899608,
"name": "document_chapter",
"update_at": 1591630591.5355852
},
{
"create_at": 1591630562.607957,
"name": "movie_chapter",
"update_at": 1591630572.689992
}
],
"count": 2
},
"message": "succeed",
"status": 200
}

上传文件

请求方式

请求方法:POST

请求URL:/course/int:course_id/documents/upload

请求参数:

请求参数 必须 类型 说明
chapter str 若不存在则自动创建
name str 文件名
document file 文件
返回示例
bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# 返回对应章节文件列表
{
"data": {
"create_at": 1591630551.3899608,
"document_count": 3,
"documents": [
{
"name": "my_document1",
"type": "excel",
"upload_at": 1591630551.3879662,
"url": "/files/course/1/documents/e7e42f60-ae50-4d55-82b7-a7b7e989e78f.xls",
"uuid": "e7e42f60-ae50-4d55-82b7-a7b7e989e78f"
},
{
"name": "my_document2",
"type": "excel",
"upload_at": 1591630681.420179,
"url": "/files/course/1/documents/8841449d-c254-43b0-ad5a-cdaf754a6fc1.xls",
"uuid": "8841449d-c254-43b0-ad5a-cdaf754a6fc1"
}
],
"name": "document_chapter",
"update_at": 1591630709.1799307
},
"message": "succeed",
"status": 200
}

上传视频

请求方式

请求方法:POST

请求URL:/course/int:course_id/movies/upload

请求参数:

请求参数 必须 类型 说明
chapter str 若不存在则自动创建
name str 视频名
movie file 视频
返回示例
bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# 返回对应章节视频列表
{
"data": {
"create_at": 1591630562.607957,
"movie_count": 2,
"movies": [
{
"name": "my_movie1",
"type": "video",
"upload_at": 1591630572.686002,
"url": "/files/course/1/movie/629532d7-5798-4666-ad70-686c196ea83a.mp4",
"uuid": "629532d7-5798-4666-ad70-686c196ea83a"
},
{
"name": "my_movie2",
"type": "video",
"upload_at": 1591630725.2619176,
"url": "/files/course/1/movie/e3ee9087-46ce-4872-87f7-3f79a79c6df4.mp4",
"uuid": "e3ee9087-46ce-4872-87f7-3f79a79c6df4"
}
],
"name": "movie_chapter",
"update_at": 1591630725.2659085
},
"message": "succeed",
"status": 200
}

获取课程文件列表

请求方式

请求方法:GET

请求URL:/course/int:course_id/documents

请求参数:无

返回示例
Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{
"data": {
"chapters": [
{
"create_at": 1591630551.3899608,
"document_count": 3,
"documents": [
{
"name": "my_document1",
"type": "excel",
"upload_at": 1591630551.3879662,
"url": "/files/course/1/documents/e7e42f60-ae50-4d55-82b7-a7b7e989e78f.xls",
"uuid": "e7e42f60-ae50-4d55-82b7-a7b7e989e78f"
}
{
"name": "my_document2",
"type": "excel",
"upload_at": 1591630709.1749458,
"url": "/files/course/1/documents/f162045c-8ac2-4f36-88d4-2c157f581262.xls",
"uuid": "f162045c-8ac2-4f36-88d4-2c157f581262"
}
],
"name": "document_chapter", # 章节名称
"update_at": 1591630709.1799307
},
{
"create_at": 1591630562.607957,
"document_count": 1,
"documents": [
{
"name": "my_document2",
"type": "excel",
"upload_at": 1591630562.6029706,
"url": "/files/course/1/documents/8f6e4cc2-7465-4542-91a7-6a4e350896f1.xls",
"uuid": "8f6e4cc2-7465-4542-91a7-6a4e350896f1"
}
],
"name": "movie_chapter", # 章节名称
"update_at": 1591630725.2659085
}
],
"count": 2
},
"message": "succeed",
"status": 200
}

获取课程视频列表

请求方式

请求方法:GET

请求URL:/course/int:course_id/movies

请求参数:无

返回示例
bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{
"data": {
"chapters": [
{
"create_at": 1591630551.3899608,
"movie_count": 2,
"movies": [
{
"name": "my_movie2",
"type": "video",
"upload_at": 1591630676.8394306,
"url": "/files/course/1/movie/f0667a7a-51c2-46ee-81db-120b5becdf29.mp4",
"uuid": "f0667a7a-51c2-46ee-81db-120b5becdf29"
}
],
"name": "document_chapter",
"update_at": 1591630709.1799307
},
{
"create_at": 1591630562.607957,
"movie_count": 2,
"movies": [
{
"name": "my_movie2",
"type": "video",
"upload_at": 1591630725.2619176,
"url": "/files/course/1/movie/e3ee9087-46ce-4872-87f7-3f79a79c6df4.mp4",
"uuid": "e3ee9087-46ce-4872-87f7-3f79a79c6df4"
}
],
"name": "movie_chapter",
"update_at": 1591630725.2659085
}
],
"count": 2
},
"message": "succeed",
"status": 200
}

课程讨论

发布讨论

请求方式

请求方法:POST

请求URL:/course/int:cid/discussions/

请求参数:

请求参数 必须 类型 说明
content str
返回示例
bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 返回讨论详细信息
{
"data": {
"comments": [],
"comments_count": 0,
"content": "how to solve the prob",
"id": "fd779a43-05d8-47f0-a91a-a9e52ef86ec4",
"post_at": 1591948027.7168016, # 讨论发布时间
"update_at": 1591948027.7168016, #讨论更新时间
"user": {
"avatar": "http://cdn.mr-lin.site/banner/banner14.jpg",
"gender": "secret",
"introduce": null,
"nickname": "3927",
"school": null,
"self": "http://127.0.0.1:5000/user/1",
"uid": 1
}
},
"message": "succeed",
"status": 200
}

获取课程讨论列表

请求方式

请求方法:GET

请求URL:/course/int:cid/discussions/

请求参数:无

返回示例
bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
 # 返回讨论列表
{
"data": {
"count": 2,
"discussions": [
{
"content": "how to solve the prob",
"id": "fd779a43-05d8-47f0-a91a-a9e52ef86ec4",
"post_at": 1591948027.7168016,
"update_at": 1591948027.7168016,
"user": {
"avatar": "http://cdn.mr-lin.site/banner/banner14.jpg",
"gender": "secret",
"introduce": null,
"nickname": "3927",
"school": null,
"self": "http://127.0.0.1:5000/user/1",
"uid": 1
}
},
{
"content": "how to solve the prob2",
"id": "1e8c034b-acf2-43a2-bd64-e76d1e0c9b1f",
"post_at": 1591948084.0913577,
"update_at": 1591948084.0913577,
"user": {
"avatar": "http://cdn.mr-lin.site/banner/banner14.jpg",
"gender": "secret",
"introduce": null,
"nickname": "3927",
"school": null,
"self": "http://127.0.0.1:5000/user/1",
"uid": 1
}
}
]
},
"message": "succeed",
"status": 200
}

获取讨论内容

请求方式

请求方法:GET

请求URL:/course/discussions/string:discus_id/comments?per_page=&page=

请求参数:无

per_page默认20,page默认1

返回示例
bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{
"data": {
"comments": [
{
"author": {
"avatar": "http://cdn.mr-lin.site/banner/banner6.jpg",
"gender": "secret",
"introduce": null,
"nickname": "lin",
"school": null,
"self": "http://127.0.0.1:5000/user/2",
"uid": 2
},
"content": "fuck you too",
"id": "af423409-7866-4809-8840-ec3e44d76043",
"liked": false,
"likes": 0,
"post_at": 1592117935.4410043,
"replies": [],
"reply": null
}
],
"count": 1,
"has_next": false,
"has_prev": true,
"max_page": 2,
"next_page": null,
"prev_page": "http://127.0.0.1:5000/course/discussions/91f00fbc-852a-4bee-b41a-d38432b6bd2b/comments?per_page=2&page=1"
},
"message": "succeed",
"status": 200
}

发布评论

请求方式

请求方法:POST

请求URL:/course/int:cid/discussions/string:discus_id

请求参数:

请求参数 必须 类型 说明
content str
reply str 回复的评论的id
返回示例
bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{  # 返回讨论信息及其回复
"data": {
"comments": [
{
"author": {
"avatar": "http://cdn.mr-lin.site/banner/banner6.jpg",
"gender": "secret",
"introduce": null,
"nickname": "lin",
"school": null,
"self": "http://127.0.0.1:5000/user/2",
"uid": 2
},
"content": "fuck you too",
"id": "7e01ca0b-2872-4e2c-b2df-b8aed6edc982",
"liked": false,
"likes": 0,
"post_at": 1592117352.2401652,
"replies": [
{
"author": {
"avatar": "http://cdn.mr-lin.site/banner/banner6.jpg",
"gender": "secret",
"introduce": null,
"nickname": "lin",
"school": null,
"self": "http://127.0.0.1:5000/user/2",
"uid": 2
},
"content": "fuck you too",
"id": "2046710d-db63-4892-99c3-9bcafe682170",
"liked": false,
"likes": 0,
"post_at": 1592117377.339128,
"replies": [],
"reply": "7e01ca0b-2872-4e2c-b2df-b8aed6edc982"
}
],
"reply": null
}
],
"content": "how to solve the prob2",
"count": 2,
"id": "97f348bc-c4ea-4e32-9420-56bfe2295823",
"post_at": 1592117334.8455448,
"update_at": 1592117334.8455448,
"user": {
"avatar": "http://cdn.mr-lin.site/banner/banner14.jpg",
"gender": "secret",
"introduce": null,
"nickname": "3927",
"school": null,
"self": "http://127.0.0.1:5000/user/1",
"uid": 1
}
},
"message": "succeed",
"status": 200
}

签到

发布签到

请求URL:/course/1/commit

请求方法:POST

请求参数:

请求参数 必须 类型 说明
expires int 持续时间

返回示例:

bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{  # 返回签到信息
"data": {
"begin": "2020/06/16 16:27:40",
"end": "2020/06/16 16:29:40",
"finished": [],
"id": "b697687f-d3b7-4b32-86ad-147192147697",
"unfinished": [
{
"id": 2,
"name": "lin"
}
]
},
"message": "succeed",
"status": 200
}

查看当前签到信息

请求URL:/course/1/commit

请求方法:GET

请求参数:无

返回示例:

bash
1
2
3
4
5
6
7
8
9
10
{
"data": {
"exist": 1, # 当前是否存在签到
"finish": 0, # 是否已完成签到
"finished": 0, # 已完成签到人数
"unfinished": 1 # 未完成签到人数
},
"message": "succeed",
"status": 200
}

进行签到

请求URL:/course/1/commit

请求方法:PUT

请求参数:无

返回示例:无返回

查看统计数据

请求URL:/course/1/commit/statistics

请求方法:GET

请求参数:无

返回示例:

bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{  # 返回历史签到数据
"data": {
"commits": [
{
"begin": "2020/06/16 16:31:29",
"end": "2020/06/16 16:41:29",
"finished": [
{
"id": 2,
"name": "lin"
}
],
"id": "638691b4-da13-4ec4-b97a-3a147e452d12",
"unfinished": []
},
{
"begin": "2020/06/16 16:27:40",
"end": "2020/06/16 16:29:40",
"finished": [],
"id": "b697687f-d3b7-4b32-86ad-147192147697",
"unfinished": [
{
"id": 2,
"name": "lin"
}
]
}
],
"count": 3
},
"message": "succeed",
"status": 200
}

tips:可以在URL里面加上commit_id参数请求某一签到的信息,/course/int:cid/commit/statistics?commit_id=

课程公告

发布公告

请求方式

请求URL:/course/int:id/notices

请求方法:POST

请求参数:

请求参数 必须 类型 说明
title str
content str
返回示例
bash
1
2
3
4
5
6
7
8
9
10
{  # 返回课程信息
"data": {
"content": "content2",
"create_at": "2020/06/16 21:30:32",
"self": "http://127.0.0.1:5000/api/course/1/notices/455c2aa2-52dd-4ff5-a5e2-1bdd1c663120",
"title": "notice2"
},
"message": "succeed",
"status": 200
}

课程公告列表

请求方式

请求URL:/course/int:id/notices

请求方法:GET

请求参数:无

返回示例
bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
"data": {
"count": 6,
"notices": [
{
"self": "http://127.0.0.1:5000/api/course/1/notices/196f106a-1a27-482c-bee8-8002770a50b6",
"title": "notice1"
},
{
"self": "http://127.0.0.1:5000/api/course/1/notices/2444f7ba-d11b-477a-949d-ae2b70ee470a",
"title": "notice2"
},
{
"self": "http://127.0.0.1:5000/api/course/1/notices/4ee1e222-ba12-4fed-a179-f5f39af9477f",
"title": "notice3"
}
]
},
"message": "succeed",
"status": 200
}

某一公告信息

请求方式

请求URL:/course/int:id/notices/string:notice_id

请求方法:GET

请求参数:无

返回示例
bash
1
2
3
4
5
6
7
8
9
10
{  # 返回课程信息
"data": {
"content": "content2",
"create_at": "2020/06/16 21:30:32",
"self": "http://127.0.0.1:5000/api/course/1/notices/455c2aa2-52dd-4ff5-a5e2-1bdd1c663120",
"title": "notice2"
},
"message": "succeed",
"status": 200
}

WebSocket

加入房间

需要参数:

cid:课程id, nickname:用户名

请求示例:
html
1
2
3
4
5
6
7
<button onclick=join_room()>join room1</button>

function join_room(){
console.log("send begin")
socket.emit('join_room', {'cid': '1', 'nickname': 'lin'})
console.log("send end")
}
返回示例:
bash
1
"3927"  # 就返回一个用户名

离开房间

需要参数:

cid:课程id, nickname:用户名

请求示例:
html
1
2
3
4
5
6
7
<button onclick=leave_room()>leave room1</button>

function leave_room(){
console.log("send begin")
socket.emit('leave_room', {'cid': '1', 'nickname': 'lin'})
console.log("send end")
}
返回示例:
bash
1
"3927"  # 就返回一个用户名

发送消息

需要参数:

cid:课程id, uid:用户id, content:消息内容

请求示例:
html
1
2
3
4
5
6
7
<button onclick=send_message()>new message</button>

function send_message(){
console.log("send begin")
socket.emit("send_message", {'cid': '1', 'uid': '1', 'content': 'test content'})
console.log("send end")
}
返回示例:
bash
1
2
3
4
5
6
7
8
9
10
11
12
{
"content": "test content",
"user": {
"self": "user/1",
"uid": 1,
"nickname": "lin",
"introduce": null,
"gender": "male",
"avatar": http://localhost/files/avatars/user/banner13.jpg,
"school": "fzu", or null
}
}

推荐推荐推荐

课程推荐

请求URL:/course/recommend?count_items=

请求方法:GET

请求参数:

请求参数 必须 类型 说明
count_items int 请求条目数,默认为5

课程讨论推荐

请求URL:/course/discussions/recommend?count_items=

请求方法:GET

请求参数:

请求参数 必须 类型 说明
count_items int 请求条目数,默认为5

有关作业

获取作业信息

请求方式

请求方法:GET

请求URL:/task/int:task_id

请求参数:无

返回示例
bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
{
"data": {
"answer_visible": true,
"create_at": 1591631497.8377042,
"finished": false,
"id": "4dbb6b79-1101-4a96-978a-d041a2e1554b",
"max_score": 280,
"problems": [
{
"content": {
"options": [
"选项A",
"选项B",
"选项C"
],
"text": "选择题文本(可为空)"
},
"create_at": 1591631497.8406956,
"id": "a3f6db75-047a-46ae-87b9-b9748c9f9d05",
"max_score": 5,
"medias": [],
"order": 1,
"type": "select"
},
{
"content": "the answer for 2333 is ___",
"create_at": 1591631497.8406956,
"id": "5c551336-e46e-4e81-bb92-6509b2f48625",
"max_score": 5,
"medias": [],
"order": 2,
"type": "blank"
},
{
"content": "how to make a girl friend",
"create_at": 1591631497.8406956,
"id": "1cffbc03-6551-4e71-9040-88dd52dd85f1",
"max_score": 90,
"medias": [],
"order": 3,
"type": "subjective"
},
{
"content": null,
"create_at": 1591631497.841693,
"id": "9f12b63a-7bfd-4760-b5d5-bb725d89bc0d",
"max_score": 90,
"medias": [],
"order": 4,
"type": "subjective"
},
{
"content": null,
"create_at": 1591631497.841693,
"id": "9bdd612c-8394-4084-8446-d0cdb6929f2b",
"max_score": 90,
"medias": [
{
"name": "e97a6349-dfd8-40ec-8af0-9709ede1a10c",
"type": "python",
"upload_at": 1591631497.8237405,
"url": "/files/problem/e97a6349-dfd8-40ec-8af0-9709ede1a10c.py",
"uuid": "e97a6349-dfd8-40ec-8af0-9709ede1a10c"
},
{
"name": "290eb18e-0eea-44eb-9c13-105f67777bea",
"type": "python",
"upload_at": 1591631497.8237405,
"url": "/files/problem/290eb18e-0eea-44eb-9c13-105f67777bea.py",
"uuid": "290eb18e-0eea-44eb-9c13-105f67777bea"
}
],
"order": 4,
"type": "subjective"
}
],
"self": "http://127.0.0.1:5000/task/4dbb6b79-1101-4a96-978a-d041a2e1554b",
"task_name": "test_task",
"time_begin": 1591526227.6053202,
"time_end": 1591526228.775193,
"type": "test"
},
"message": "succeed",
"status": 200
}

若用户已完成作业且作业的答案可见,则会一起“answer” 与 “answer_detail”,格式如下

bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{
"data": {
"answer_visible": true,
"create_at": 1591634313.937611,
"finished": true,
"id": "48611f75-e4d6-4928-bc41-dfd6c2756efc",
"max_score": 280,
"problems": [
{
"answer": [
"A"
],
"answer_detail": "可为空",
"content": {
"options": [
"选项A",
"选项B",
"选项C"
],
"text": "选择题文本(可为空)"
},
"create_at": 1591634313.9425974,
"id": "0314eebe-ff68-4482-a472-8199dd7fa753",
"max_score": 5,
"medias": [],
"order": 1,
"type": "select"
},
{
"answer": [
"A",
"3rd23"
],
"answer_detail": "可为空",
"content": "the answer for 2333 is ___",
"create_at": 1591634313.9435947,
"id": "1d1c3d97-6711-413c-8f50-d5840a75a962",
"max_score": 5,
"medias": [],
"order": 2,
"type": "blank"
},
{
"answer": "i do not know",
"answer_detail": "fuck you",
"content": "how to make a girl friend",
"create_at": 1591634313.9435947,
"id": "8074525c-3c0a-415a-a5e8-23761449f886",
"max_score": 90,
"medias": [],
"order": 3,
"type": "subjective"
}
],
"self": "http://127.0.0.1:5000/task/48611f75-e4d6-4928-bc41-dfd6c2756efc",
"task_name": "test_task",
"time_begin": 1591526227.6053202,
"time_end": 1591526228.775193,
"type": "test"
},
"message": "succeed",
"status": 200
}

删除作业

url与获取作业相同,方法为delete,没有返回值

提交作业

请求方式

请求方法:POST

请求URL:/task/submit/?id=string:task_id

请求参数:

请求参数 必须 类型 说明
answers list 包括许多回答

answers中每个answer所要具有的参数如下

请求参数 必须 类型 说明
order int 题号
content 论述题为字符串,其它为列表 答案内容
answer + order file 学生对应题号题目上传的文件
返回示例
bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
{
"data": {
"answers": [
{
"answer_at": 1591632818.92645,
"answer_detail": "可为空",
"comment": null, # 教师评语
"content": [
"A"
],
"correct_answer": [ # 若作业的ans_visible值为True,则会一起返回答案
"A"
],
"id": "9fab831e-7814-4988-b47c-91653a9bff25",
"medias": null,
"order": 1,
"score": 5,
"update_at": 1591632818.92645
},
{
"answer_at": 1591632818.9274461,
"answer_detail": "可为空",
"comment": null,
"content": [
"A",
""
],
"correct_answer": [
"A",
"3rd23"
],
"id": "459631f9-5ce8-472a-82f5-8adc7850a317",
"medias": null,
"order": 2,
"score": 2.5,
"update_at": 1591632818.9274461
},
{
"answer_at": 1591632818.9563687,
"answer_detail": "fuck you",
"comment": null,
"content": null,
"correct_answer": "i do not know",
"id": "fe9695b2-1cbb-4ba0-a564-5ec4aeafd9f7",
"medias": [
{
"name": "45fb2e6e-e7a8-4297-b8b1-28359b238df0",
"type": "word",
"upload_at": 1591632818.9194677,
"url": "/files/answer/45fb2e6e-e7a8-4297-b8b1-28359b238df0.docx",
"uuid": "45fb2e6e-e7a8-4297-b8b1-28359b238df0"
}
],
"order": 3,
"score": 0,
"update_at": 1591632819.0201979
},
{
"answer_at": 1591632819.021195,
"answer_detail": "fuck you",
"comment": null,
"content": null,
"correct_answer": "i do not know",
"id": "a26d33e2-f357-455f-9bbf-5d8762c613f6",
"medias": null,
"order": 4,
"score": 0,
"update_at": 1591632819.021195
}
],
"create_at": 1591632818.9224591,
"score": 7.5, # 分数
"status": false, # 老师是否已批改
"update_at": 1591632819.0062351,
"uuid": "57e908ac-aa79-45e8-91e1-f7799e32f293"
},
"message": "succeed",
"status": 200
}

或者我也可以返回这种格式的数据(将回答对应的题目一起返回)

bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
{
"data": {
"answers": [ #key为answers但实际上为一个问题列表
{
"answer": [ # 正确答案
"A"
],
"answer_detail": "可为空",
"content": {
"options": [
"选项A",
"选项B",
"选项C"
],
"text": "选择题文本(可为空)"
},
"create_at": 1591633311.727396,
"id": "9f7f5df8-e8fe-44cb-9b19-c515cd993b9e",
"max_score": 5,
"medias": [],
"order": 1,
"student_answer": { # 用户的回答
"answer_at": 1591633322.4138145,
"comment": null,
"content": [
"A"
],
"id": "84828237-7312-43af-9cf2-58ad8e6c228c",
"medias": null,
"order": 1,
"score": 5,
"update_at": 1591633322.4138145
},
"type": "select"
},
{
"answer": [
"A",
"3rd23"
],
"answer_detail": "可为空",
"content": "the answer for 2333 is ___",
"create_at": 1591633311.727396,
"id": "79cd6af0-ae50-45eb-85cc-17c462e48472",
"max_score": 5,
"medias": [],
"order": 2,
"student_answer": {
"answer_at": 1591633322.4148123,
"comment": null,
"content": [
"A",
""
],
"id": "db351ad7-8e94-44a9-a8d2-fbf16a449815",
"medias": null,
"order": 2,
"score": 2.5,
"update_at": 1591633322.4148123
},
"type": "blank"
},
{
"answer": "i do not know",
"answer_detail": "fuck you",
"content": "how to make a girl friend",
"create_at": 1591633311.7283938,
"id": "7ceee678-f880-40be-a122-cca34784864d",
"max_score": 90,
"medias": [],
"order": 3,
"student_answer": {
"answer_at": 1591633322.43077,
"comment": null,
"content": null,
"id": "244b23a0-6453-4616-b8e4-804bb000a93c",
"medias": [
{
"name": "dd5e08a6-f854-46ef-9159-c719c22423a9",
"type": "word",
"upload_at": 1591633322.406833,
"url": "/files/answer/dd5e08a6-f854-46ef-9159-c719c22423a9.docx",
"uuid": "dd5e08a6-f854-46ef-9159-c719c22423a9"
}
],
"order": 3,
"score": 0,
"update_at": 1591633322.4557025
},
"type": "subjective"
}
],
"create_at": 1591633322.409824,
"score": 7.5,
"status": false, # 教师批改状态
"update_at": 1591633322.4457285,
"uuid": "14b8d0f9-8cde-4628-9b23-bcb0046140bb"
},
"message": "succeed",
"status": 200
}

批改作业

请求方式

请求方法:POST

请求URL:/task/answers/correct_answer?task_answer_id=string:task_answer_id

请求参数:

请求参数 必须 类型 说明
check_res list 一个包含每一题批改结果的列表

列表中每一项应该包含的参数为:

请求参数 必须 类型 说明
order int 题号
score int 分数
comment str 教师点评
返回示例
bash
1
2
3
4
5
{
"data": "OK",
"message": "succeed",
"status": 200
}

获取用户已提交答案

请求方式

请求方法:GET

请求URL:/task/string:task_id/answers?[uncheck=]

请求参数:无

说明:默认情况下获取当前用户(token对应用户)对该次作业已提交的答案,若设置uncheck为true,则会获取一份未批改的答案

返回示例
bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# 与提交答案时的返回格式相同
{
"data": {
"answers": [
{
"answer_at": 1591634370.182178,
"answer_detail": "可为空",
"comment": null,
"content": [
"A"
],
"correct_answer": [
"A"
],
"id": "0ce11dca-3dd3-4610-91ce-6cabb5c47bca",
"medias": null,
"order": 1,
"score": 5,
"update_at": 1591634370.182178
},
{
"answer_at": 1591634370.1831753,
"answer_detail": "可为空",
"comment": null,
"content": [
"A",
""
],
"correct_answer": [
"A",
"3rd23"
],
"id": "15b4e56c-7b15-4fd0-af76-1211fed419e6",
"medias": null,
"order": 2,
"score": 2.5,
"update_at": 1591634370.1831753
},
{
"answer_at": 1591634370.2011268,
"answer_detail": "fuck you",
"comment": null,
"content": null,
"correct_answer": "i do not know",
"id": "e89cb8e3-56fc-45f4-b644-7e9c1d32f1d8",
"medias": [
{
"name": "842f01fb-a92a-43ff-8762-fcacadb289fb",
"type": "word",
"upload_at": 1591634370.1771913,
"url": "/files/answer/842f01fb-a92a-43ff-8762-fcacadb289fb.docx",
"uuid": "842f01fb-a92a-43ff-8762-fcacadb289fb"
}
],
"order": 3,
"score": 0,
"update_at": 1591634370.2210739
}
],
"create_at": 1591634370.1801827,
"score": 7.5,
"status": false,
"update_at": 1591634370.2150893,
"uuid": "8af659e1-7a6d-4236-869e-8a26a46b33a5"
},
"message": "succeed",
"status": 200
}

作业统计数据

请求url:/task/string:tid/statistic?detail=True/False

请求方法:GET

说明:detail推荐为true,为false返回的数据你也可以请求一下看一看

返回示例:

bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
"data": {
"average": 7.5,
"fail_detail": [
"lin"
],
"finish_cnt": 1,
"finish_rate": 1.0,
"finished_detail": [
"lin"
],
"pass_cnt": 0,
"pass_detail": [],
"pass_rate": 0.0,
"section_count": {"0": 1, "10", 23, "20": 34}, "0"代表0-10分数段,"10"代表10-20分数段,以此类推
"total_cnt": 1,
"unfinished_detail": []
},
"message": "succeed",
"status": 200
}

题目统计数据

请求URl:/task/string:tid/statistic/problems?order=int:order&detail=True

请求方法:GET

说明:detail同上

bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{
"data": {
"average": 5.0,
"correct_detail": [
"lin"
],
"correct_rate": 1.0,
"fail_detail": [],
"pass_detail": [
"lin"
],
"pass_rate": 1.0
},
"message": "succeed",
"status": 200
}

学生列表统计数据

请求url:/task/string:tid/statistic/stu_status

请求方法:GET

bash
1
2
3
4
5
6
7
8
9
10
11
12
{
"data": [
{
"finished": true,
"name": "lin",
"score": 7.5,
"student_id": null
}
],
"message": "succeed",
"status": 200
}

有关头像

用户头像

请求方式

请求方法:POST

请求URL:/avatars/user/int:uid

请求参数:

请求参数 必须 类型 说明
avatar file
返回示例

无返回

说明

用get方法请求该url可以获取用户头像,原理是请求该url后重定向到实际给出头像的url。但是请求用户信息时返回的信息中会有一个avatar参数对应其真实的URL,所以这个其实应该没什么用。

课程头像

请求方式

请求方法:POST

请求URL:/avatars/course/int:cid

请求参数:

请求参数 必须 类型 说明
avatar file
返回示例

无返回

说明

该URL的get方法同用户

文章作者: 3927o
文章链接: http://yoursite.com/%E9%9B%B7%E8%AF%BE%E5%A0%82API%E6%96%87%E6%A1%A3ver1.3.1/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 lin's document

评论