|
|
@@ -453,18 +453,23 @@ export interface CourseRecord {
|
|
|
* ⚠ `pay`=应收金额(端点53 口径,保留);`paid`=是否已付(端点52 请求 0/1、端点51 perStudent bool 的布尔源,
|
|
|
* 与 `pay` 金额是两个概念,不可复用同一字段)。 */
|
|
|
students: { userId: string; type: number; pay: number; cost: number; giveCost: number; paid: boolean }[];
|
|
|
+ /** 排班规则"上课/下课时分"(端点 46 口径,Go 注释 date 恒 1970-01-01 只取时分;`HH:mm` 5 字符,max=5) */
|
|
|
+ startHM: string;
|
|
|
+ endHM: string;
|
|
|
}
|
|
|
export interface Course {
|
|
|
id: number;
|
|
|
institutionId: number;
|
|
|
name: string;
|
|
|
- classify: string;
|
|
|
- status: 0 | 1;
|
|
|
+ /** 课程分类 ID(int64;Go courseRowView.Classify int64;前端用 classifyText 映射成学科名) */
|
|
|
+ classify: number;
|
|
|
+ /** 课程状态(Go courseStatusFilter 白名单:0 未发布 / 1 发布未开始 / 2 进行中 / 3 已结束) */
|
|
|
+ status: 0 | 1 | 2 | 3;
|
|
|
teacherIds: string[];
|
|
|
records: CourseRecord[];
|
|
|
}
|
|
|
let recordSeq = 6000;
|
|
|
-function mkRecord(courseId: number, teacherId: string, campusId: number, address: string, week: string, offsetDays: number, status: 0 | 1 | 2): CourseRecord {
|
|
|
+function mkRecord(courseId: number, teacherId: string, campusId: number, address: string, week: string, offsetDays: number, status: 0 | 1 | 2, startHM = '09:00', endHM = '10:30'): CourseRecord {
|
|
|
const start = BASE_MS + offsetDays * 86400_000;
|
|
|
const present = (on: boolean): number => (status === 2 && on ? 1 : 0); // 已结束课才有出勤 type=1(正常)
|
|
|
return {
|
|
|
@@ -477,6 +482,9 @@ function mkRecord(courseId: number, teacherId: string, campusId: number, address
|
|
|
startTime: rfc3339(start),
|
|
|
endTime: rfc3339(start + 90 * 60_000),
|
|
|
status,
|
|
|
+ /** 端点 46 时分(Go 语义:date 恒 1970-01-01 只取时分;HH:mm) */
|
|
|
+ startHM,
|
|
|
+ endHM,
|
|
|
students: [
|
|
|
{ userId: ulid(201), type: present(true), pay: 10000, cost: 10000, giveCost: 0, paid: true },
|
|
|
{ userId: ulid(202), type: present(true), pay: 10000, cost: 10000, giveCost: 0, paid: true },
|
|
|
@@ -486,24 +494,24 @@ function mkRecord(courseId: number, teacherId: string, campusId: number, address
|
|
|
}
|
|
|
const courses: Course[] = [
|
|
|
{
|
|
|
- id: 1, institutionId: 1, name: '数学 8 班', classify: '数学', status: 1, teacherIds: [ulid(101)],
|
|
|
+ id: 1, institutionId: 1, name: '数学 8 班', classify: 1, status: 2, teacherIds: [ulid(101)],
|
|
|
records: [
|
|
|
- mkRecord(1, ulid(101), 11, '滨江校区 3 楼 305 教室', '1,3,5', -3, 2),
|
|
|
- mkRecord(1, ulid(101), 11, '滨江校区 3 楼 305 教室', '1,3,5', 0, 0),
|
|
|
- mkRecord(1, ulid(101), 11, '滨江校区 5 楼 502 教室', '2,4', 2, 0),
|
|
|
- mkRecord(1, ulid(101), 11, '滨江校区 3 楼 305 教室', '-1', 4, 0),
|
|
|
+ mkRecord(1, ulid(101), 11, '滨江校区 3 楼 305 教室', '1,3,5', -3, 2, '09:00', '10:30'),
|
|
|
+ mkRecord(1, ulid(101), 11, '滨江校区 3 楼 305 教室', '1,3,5', 0, 0, '09:00', '10:30'),
|
|
|
+ mkRecord(1, ulid(101), 11, '滨江校区 5 楼 502 教室', '2,4', 2, 0, '14:00', '15:30'),
|
|
|
+ mkRecord(1, ulid(101), 11, '滨江校区 3 楼 305 教室', '-1', 4, 0, '16:00', '17:30'),
|
|
|
],
|
|
|
},
|
|
|
{
|
|
|
- id: 2, institutionId: 1, name: '物理 3 班', classify: '物理', status: 1, teacherIds: [ulid(102)],
|
|
|
- records: [mkRecord(2, ulid(102), 12, '城西校区 1 楼 102 教室', '3', -1, 1), mkRecord(2, ulid(102), 12, '城西校区 1 楼 102 教室', '3', 1, 0)],
|
|
|
+ id: 2, institutionId: 1, name: '物理 3 班', classify: 2, status: 1, teacherIds: [ulid(102)],
|
|
|
+ records: [mkRecord(2, ulid(102), 12, '城西校区 1 楼 102 教室', '3', -1, 1, '10:00', '11:30'), mkRecord(2, ulid(102), 12, '城西校区 1 楼 102 教室', '3', 1, 0, '10:00', '11:30')],
|
|
|
},
|
|
|
{
|
|
|
- id: 3, institutionId: 1, name: '英语 1 班', classify: '英语', status: 0, teacherIds: [ulid(101)],
|
|
|
- records: [mkRecord(3, ulid(101), 11, '滨江校区 4 楼 401 教室', '6', -7, 2)],
|
|
|
+ id: 3, institutionId: 1, name: '英语 1 班', classify: 3, status: 0, teacherIds: [ulid(101)],
|
|
|
+ records: [mkRecord(3, ulid(101), 11, '滨江校区 4 楼 401 教室', '6', -7, 2, '15:00', '16:30')],
|
|
|
},
|
|
|
];
|
|
|
-export function queryCourses(f: { classify?: string; status?: number; keyword?: string; institutionId?: number; campusId?: number }): Course[] {
|
|
|
+export function queryCourses(f: { classify?: number; status?: number; keyword?: string; institutionId?: number; campusId?: number }): Course[] {
|
|
|
return courses.filter((c) => {
|
|
|
if (f.classify && c.classify !== f.classify) return false;
|
|
|
if (f.status !== undefined && c.status !== f.status) return false;
|