2026-02-28 16:41:39 +08:00
|
|
|
|
# 开发日志 - 2026年2月14日
|
|
|
|
|
|
|
|
|
|
|
|
## 今日工作概要
|
|
|
|
|
|
|
|
|
|
|
|
完成P0和P1优先级功能开发,包括学校端核心管理模块、教师端首页数据、以及四个P1扩展功能(资源库、成长档案、阅读任务、课程反馈)。
|
|
|
|
|
|
|
|
|
|
|
|
## 详细工作内容
|
|
|
|
|
|
|
|
|
|
|
|
### 1. P0核心功能 - 学校端管理模块
|
|
|
|
|
|
|
|
|
|
|
|
**新增模块**: `src/modules/school/`
|
|
|
|
|
|
|
|
|
|
|
|
| 功能 | 控制器 | 服务 | API端点 |
|
|
|
|
|
|
|-----|-------|------|---------|
|
|
|
|
|
|
| 教师管理 | school.controller.ts | school.service.ts | `/school/teachers` |
|
|
|
|
|
|
| 学生管理 | student.controller.ts | student.service.ts | `/school/students` |
|
|
|
|
|
|
| 班级管理 | school.controller.ts | school.service.ts | `/school/classes` |
|
|
|
|
|
|
| 统计数据 | stats.controller.ts | stats.service.ts | `/school/stats` |
|
|
|
|
|
|
| 套餐信息 | package.controller.ts | - | `/school/package` |
|
|
|
|
|
|
|
|
|
|
|
|
**核心API端点**:
|
|
|
|
|
|
```
|
|
|
|
|
|
# 教师管理
|
|
|
|
|
|
GET/POST /school/teachers
|
|
|
|
|
|
GET/PUT/DELETE /school/teachers/:id
|
|
|
|
|
|
POST /school/teachers/:id/reset-password
|
|
|
|
|
|
|
|
|
|
|
|
# 学生管理
|
|
|
|
|
|
GET/POST /school/students
|
|
|
|
|
|
GET/PUT/DELETE /school/students/:id
|
|
|
|
|
|
POST /school/students/import
|
|
|
|
|
|
|
|
|
|
|
|
# 班级管理
|
|
|
|
|
|
GET/POST /school/classes
|
|
|
|
|
|
GET/PUT/DELETE /school/classes/:id
|
|
|
|
|
|
|
|
|
|
|
|
# 统计数据
|
|
|
|
|
|
GET /school/stats
|
|
|
|
|
|
GET /school/stats/teachers
|
|
|
|
|
|
GET /school/stats/courses
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### 2. P0核心功能 - 教师端首页API
|
|
|
|
|
|
|
|
|
|
|
|
**更新模块**: `src/modules/teacher-course/`
|
|
|
|
|
|
|
|
|
|
|
|
新增API端点:
|
|
|
|
|
|
```
|
|
|
|
|
|
GET /teacher/dashboard # 首页全部数据
|
|
|
|
|
|
GET /teacher/dashboard/today # 今日课程
|
|
|
|
|
|
GET /teacher/dashboard/recommend # 推荐课程
|
|
|
|
|
|
GET /teacher/dashboard/weekly # 本周统计
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### 3. 登录功能修复
|
|
|
|
|
|
|
|
|
|
|
|
**问题**: 学校端登录失败,租户使用中文名称作为账号
|
|
|
|
|
|
|
|
|
|
|
|
**解决方案**:
|
|
|
|
|
|
1. 数据库Schema更新 - Tenant模型添加字段:
|
|
|
|
|
|
```prisma
|
|
|
|
|
|
loginAccount String? @unique @map("login_account")
|
|
|
|
|
|
passwordHash String? @map("password_hash")
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
2. 认证服务更新 - `auth.service.ts`:
|
|
|
|
|
|
```typescript
|
|
|
|
|
|
// 使用 loginAccount 查询,bcrypt 验证密码
|
|
|
|
|
|
const tenant = await this.prisma.tenant.findUnique({
|
|
|
|
|
|
where: { loginAccount: account },
|
|
|
|
|
|
});
|
|
|
|
|
|
const isValid = await bcrypt.compare(password, tenant.passwordHash);
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
**测试账号**:
|
|
|
|
|
|
- 学校端: school1 / 123456
|
|
|
|
|
|
- 教师端: teacher1 / 123456
|
2026-03-14 16:50:54 +08:00
|
|
|
|
- 超管端: admin / 123456
|
2026-02-28 16:41:39 +08:00
|
|
|
|
|
|
|
|
|
|
### 4. P1功能 - 资源库管理
|
|
|
|
|
|
|
|
|
|
|
|
**新增模块**: `src/modules/resource/`
|
|
|
|
|
|
|
|
|
|
|
|
数据库表:
|
|
|
|
|
|
```prisma
|
|
|
|
|
|
model ResourceLibrary {
|
|
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
|
|
name String
|
|
|
|
|
|
libraryType String @map("library_type") // PICTURE_BOOK, MATERIAL, TEMPLATE
|
|
|
|
|
|
description String?
|
|
|
|
|
|
coverImage String? @map("cover_image")
|
|
|
|
|
|
tenantId Int? @map("tenant_id")
|
|
|
|
|
|
createdBy Int @map("created_by")
|
|
|
|
|
|
status String @default("PUBLISHED")
|
|
|
|
|
|
items ResourceItem[]
|
|
|
|
|
|
}
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### 5. P1功能 - 成长档案
|
|
|
|
|
|
|
|
|
|
|
|
**新增模块**: `src/modules/growth/`
|
|
|
|
|
|
|
|
|
|
|
|
API端点:
|
|
|
|
|
|
```
|
|
|
|
|
|
# 学校端
|
|
|
|
|
|
GET/POST /school/growth-records
|
|
|
|
|
|
GET/PUT/DELETE /school/growth-records/:id
|
|
|
|
|
|
|
|
|
|
|
|
# 教师端
|
|
|
|
|
|
GET/POST /teacher/growth-records
|
|
|
|
|
|
GET/PUT/DELETE /teacher/growth-records/:id
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### 6. P1功能 - 阅读任务
|
|
|
|
|
|
|
|
|
|
|
|
**新增模块**: `src/modules/task/`
|
|
|
|
|
|
|
|
|
|
|
|
数据库表:
|
|
|
|
|
|
```prisma
|
|
|
|
|
|
model Task {
|
|
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
|
|
tenantId Int @map("tenant_id")
|
|
|
|
|
|
title String
|
|
|
|
|
|
taskType String @map("task_type") // READING, ACTIVITY, HOMEWORK
|
|
|
|
|
|
targetType String @map("target_type") // CLASS, STUDENT
|
|
|
|
|
|
relatedCourseId Int? @map("related_course_id")
|
|
|
|
|
|
startDate DateTime @map("start_date")
|
|
|
|
|
|
endDate DateTime @map("end_date")
|
|
|
|
|
|
status String @default("PUBLISHED")
|
|
|
|
|
|
targets TaskTarget[]
|
|
|
|
|
|
completions TaskCompletion[]
|
|
|
|
|
|
}
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### 7. P1功能 - 课程反馈
|
|
|
|
|
|
|
|
|
|
|
|
新增API端点:
|
|
|
|
|
|
```
|
|
|
|
|
|
# 教师端
|
|
|
|
|
|
POST /teacher/lessons/:id/feedback
|
|
|
|
|
|
GET /teacher/lessons/:id/feedback
|
|
|
|
|
|
|
|
|
|
|
|
# 学校端
|
|
|
|
|
|
GET /school/feedbacks
|
|
|
|
|
|
GET /school/feedbacks/stats
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## 测试验证
|
|
|
|
|
|
|
|
|
|
|
|
- [x] 学校端登录(school1 / 123456)
|
|
|
|
|
|
- [x] 教师端登录(teacher1 / 123456)
|
|
|
|
|
|
- [x] 教师管理 CRUD
|
|
|
|
|
|
- [x] 学生管理 CRUD
|
|
|
|
|
|
- [x] 班级管理 CRUD
|
|
|
|
|
|
- [x] 教师首页数据展示
|
|
|
|
|
|
- [x] 资源库管理
|
|
|
|
|
|
- [x] 成长档案管理
|
|
|
|
|
|
- [x] 阅读任务管理
|
|
|
|
|
|
- [x] 课程反馈功能
|
|
|
|
|
|
|
|
|
|
|
|
## 待处理事项
|
|
|
|
|
|
|
|
|
|
|
|
1. [ ] 前端教师端反馈提交界面(上课结束后提交反馈)
|
|
|
|
|
|
2. [ ] 前端教师端成长档案和任务页面
|
|
|
|
|
|
3. [ ] 数据导入功能优化
|
|
|
|
|
|
4. [ ] 移动端适配
|
|
|
|
|
|
5. [ ] 性能优化(大量学生/课程时的分页加载)
|