班级管理
这里的班级是基于科目的教学班,是学生上课、老师教学的基本单位,随着学校选课走班的的实施,教学班将成为越来越重要的教学与管理单位。
一个教学班主要由三类信息组成,时间信息,空间信息和描述信息:
时间信息 是指教学班的上课时间,与 start_at
, end_in
, week_type
, schedules
, semester_id
这五个字段密切相关:
start_at
表示班级的开始周数,从 1 开始end_in
表示班级的结束周数,必须大于1week_type
表示单双周上课,默认为0,表示单周和双周都上课,1表示单周上课,2表示双周上课schedules
表示一周内的上课时间,为一个数组,每个元素包含day
和lesson
两个元素,分别表示上课的周和节次。比如[{day: 1, lesson: 1}, {day: 2, lesson:4}]
表示班级在周一第1节和周二第4节
上课。semester_id
班级所在的学期,是一个更大的范围,只有该学期是当前学期才会上课
只有当 semester.is_current == true && class.start_at >= semester.current_week && class.end_in <= semester.current_week
时,班级才处于上课状态,这是渲染周课表和日课表的核心逻辑。
空间信息 是指教学班的上课地点,通过 locations
字段表示,系统支持多个上课地点,不同的节次使用不同的上课地点。classroom
为历史遗留字段,只能用于一个班级只有一个上课地点的场景,不再推荐使用。
描述信息 是指其他描述类型的数据,比如名称,科目,学分等,对班级进行补充说明。
下表是教学班简要的字段介绍:
数据结构
字段名称 | 类型 | 描述 |
---|---|---|
id | integer | 班级ID |
semester_id | integer | 学期 ID |
name | string | 课名 |
csin | enum | 课程编号 |
class_name | string | 班级名称,比如1班、2班 |
teachers | Reflection[] | 授课教师, 允许为 [] |
credit | integer | 学分 |
duration | string | 学时 |
description | string | 课程描述 |
attribute | object | 课程属性(必修,选修之类) |
subject | object | 科目 |
grade | object | 班级所属的年级,为空表示不限,多个年级以","分隔 |
start_at | integer | 上课开始周 |
end_in | integer | 上课结束周 |
week_type | integer | 单双周 1 => 单周 2 => 双周 0 => 单双周都有课 |
capacity | integer | 容量 |
schedules | Object[] | 上课时间,允许为 [] |
locations | Array | 该班级的教室列表,配合 schedules.location_id 确定每节课的上课地点 |
classroom | Object | 该班级的第一个教室,为兼容历史 API 而保留 |
admin_class_ids | Array | 所属行政班 ids |
.... | string | 其他扩展字段 |
示例:
{
"id": 57010,
"school_id": 3,
"semester_id": 369,
"csin": "AR441",
"teach_by": 31364,
"name": "Intro to Watercolor",
"plan_id": 65,
"credit": "4.0",
"duration": 4,
"description": "",
"start_at": 1,
"end_in": 21,
"week_type": 0,
"capacity": 15,
"class_name": "1班",
"teachers": [], //Reflection[]
"subject": {
"id": 3773,
"school_id": 3,
"name": "语文"
},
"grade": {
"id": 3774,
"school_id": 3,
"name": "高一,高二"
},
"schedules": [
{
"day": 1, // 周一
"location_id": 100, // 教室ID, 对应 locations 的第1个元素
"lesson": 3 // 第3节
},
{
"day": 2, // 周二
"location_id": 101, // 教室ID, 对应 locations 的第2个元素
"lesson": 4 // 第4节
}
],
"locations": [
{
"id": 100,
"name": "教室1"
},
{
"id": 101,
"name": "教室2"
},
],
"attribute": {
"id": 3727,
"school_id": 3,
"type": "course_attribute",
"name": "optional \u9009\u4fee"
},
"admin_class_ids" => [
321, 322
],
"department": "\u9053\u5c14\u987f\u5b66\u9662", //扩展字段
"domain": "Art" //扩展字段
}
班级 API
1、获取班级列表
GET https://open.seiue.com/api/v1/classes?semester_id=1&$per-page=10&$page=1
Parameters
Name | Type | Description |
---|---|---|
semester_id | integer | 班级的学期 id |
admin_class_id | string | 行政班的 id(s),多个 ID 逗号分隔 |
week_range | string | 开课周区间,比如1-8 ,在此区间上课的班级都会返回 |
Response 200
满足条件的班级列表,可分页
2、获取班级学生列表
GET https://open.seiue.com/api/v1/classes/:id/students
Parameters
Name | Type | Description |
---|---|---|
id | integer | 班级id |
Response 200
班级下的学生列表,无分页