v0.1测试

This commit is contained in:
2026-04-07 17:07:13 +08:00
parent 593973f598
commit 6b1b586fe3
80 changed files with 9073 additions and 32 deletions

View File

@@ -0,0 +1,11 @@
# ===========================================
# 班级操行分管理系统 - 后端服务
#
# 开发者: Canglan
# 联系方式: admin@sea-studio.top
# 版权归属: Sea Network Technology Studio
# 许可证: MIT License
#
# 版权所有 © Sea Network Technology Studio
# ===========================================

81
backend/schemas/admin.py Normal file
View File

@@ -0,0 +1,81 @@
# ===========================================
# 班级操行分管理系统 - 后端服务
#
# 开发者: Canglan
# 联系方式: admin@sea-studio.top
# 版权归属: Sea Network Technology Studio
# 许可证: MIT License
#
# 版权所有 © Sea Network Technology Studio
# ===========================================
from pydantic import BaseModel, Field
from typing import Optional, List
from datetime import date, datetime
class AddPointsRequest(BaseModel):
"""加减分请求"""
student_ids: List[int] = Field(..., description="学生ID列表")
points_change: int = Field(..., description="分数变动")
reason: str = Field(..., min_length=1, max_length=255, description="原因")
class AddPointsResponse(BaseModel):
"""加减分响应"""
success_count: int
fail_count: int
details: List[dict]
class RevokeRequest(BaseModel):
"""撤销请求"""
record_id: int = Field(..., description="记录ID")
class ImportStudentsRequest(BaseModel):
"""导入学生请求"""
students: List[dict] = Field(..., description="学生列表")
class ImportResult(BaseModel):
"""导入结果"""
total: int
success: int
failed: int
errors: List[str]
class AddAdminRequest(BaseModel):
"""添加管理员请求"""
username: str = Field(..., min_length=1, max_length=50, description="登录账号")
real_name: str = Field(..., min_length=1, max_length=50, description="真实姓名")
password: Optional[str] = Field(None, description="密码(不填则自动生成)")
role_type: str = Field(..., description="角色类型")
class_id: int = Field(..., description="班级ID")
subject_id: Optional[int] = Field(None, description="科目ID科代表需要")
class AddAdminResponse(BaseModel):
"""添加管理员响应"""
success: bool
username: str
password: Optional[str] = None
message: str
class UpdateHomeworkStatusRequest(BaseModel):
"""更新作业状态请求"""
submission_id: int
status: str
comments: Optional[str] = None
apply_deduction: bool = False
class AddAttendanceRequest(BaseModel):
"""添加考勤请求"""
student_id: int
date: date
status: str
reason: Optional[str] = None
apply_deduction: bool = False

54
backend/schemas/auth.py Normal file
View File

@@ -0,0 +1,54 @@
# ===========================================
# 班级操行分管理系统 - 后端服务
#
# 开发者: Canglan
# 联系方式: admin@sea-studio.top
# 版权归属: Sea Network Technology Studio
# 许可证: MIT License
#
# 版权所有 © Sea Network Technology Studio
# ===========================================
from pydantic import BaseModel, Field
from typing import Optional
class LoginRequest(BaseModel):
"""登录请求"""
username: str = Field(..., min_length=1, max_length=50, description="用户名")
password: str = Field(..., min_length=1, max_length=50, description="密码")
class LoginResponse(BaseModel):
"""登录响应"""
success: bool
token: str
user_id: int
username: str
real_name: str
user_type: str
need_change_password: bool
redirect: str
class ChangePasswordRequest(BaseModel):
"""修改密码请求"""
old_password: str = Field(..., min_length=1, max_length=50, description="原密码")
new_password: str = Field(..., min_length=6, max_length=20, description="新密码")
class ChangePasswordResponse(BaseModel):
"""修改密码响应"""
success: bool
message: str
class UserInfo(BaseModel):
"""用户信息"""
user_id: int
username: str
real_name: str
user_type: str
student_id: Optional[int] = None
role: Optional[str] = None
need_change_password: bool

View File

@@ -0,0 +1,79 @@
# ===========================================
# 班级操行分管理系统 - 后端服务
#
# 开发者: Canglan
# 联系方式: admin@sea-studio.top
# 版权归属: Sea Network Technology Studio
# 许可证: MIT License
#
# 版权所有 © Sea Network Technology Studio
# ===========================================
from pydantic import BaseModel, Field
from typing import Optional, List
from datetime import date, datetime
class StudentInfo(BaseModel):
"""学生信息"""
student_id: int
student_no: str
name: str
class_id: int
class_name: Optional[str] = None
total_points: int
parent_phone: Optional[str] = None
status: int
class ConductRecord(BaseModel):
"""操行分记录"""
record_id: int
student_id: int
student_name: Optional[str] = None
points_change: int
reason: str
recorder_id: int
recorder_name: str
related_type: str
is_revoked: bool
created_at: datetime
class ConductHistoryResponse(BaseModel):
"""操行分历史响应"""
student_id: int
student_name: str
total_points: int
records: List[ConductRecord]
class HomeworkSubmission(BaseModel):
"""作业提交情况"""
assignment_id: int
title: str
subject: str
deadline: date
status: str
submit_time: Optional[datetime] = None
comments: Optional[str] = None
deduction_applied: bool
class AttendanceRecord(BaseModel):
"""考勤记录"""
attendance_id: int
date: date
status: str
reason: Optional[str] = None
deduction_applied: bool
class StudentRanking(BaseModel):
"""学生排行"""
student_id: int
student_no: str
name: str
class_name: str
total_points: int
rank_in_class: int

View File

@@ -0,0 +1,43 @@
# ===========================================
# 班级操行分管理系统 - 后端服务
#
# 开发者: Canglan
# 联系方式: admin@sea-studio.top
# 版权归属: Sea Network Technology Studio
# 许可证: MIT License
#
# 版权所有 © Sea Network Technology Studio
# ===========================================
from pydantic import BaseModel, Field
from typing import Optional, List
class SubjectInfo(BaseModel):
"""科目信息"""
subject_id: int
subject_name: str
subject_code: Optional[str] = None
is_active: bool
sort_order: int
class CreateSubjectRequest(BaseModel):
"""创建科目请求"""
subject_name: str = Field(..., min_length=1, max_length=50, description="科目名称")
subject_code: Optional[str] = Field(None, max_length=20, description="科目代码")
sort_order: int = Field(0, description="排序序号")
class UpdateSubjectRequest(BaseModel):
"""更新科目请求"""
subject_name: Optional[str] = Field(None, max_length=50, description="科目名称")
subject_code: Optional[str] = Field(None, max_length=20, description="科目代码")
is_active: Optional[bool] = Field(None, description="是否启用")
sort_order: Optional[int] = Field(None, description="排序序号")
class SubjectListResponse(BaseModel):
"""科目列表响应"""
subjects: List[SubjectInfo]
total: int