v4.2 科目管理优化与多项修复清理
1. 科目管理:代码长度放宽至50(含数据库升级v4.2)、编辑可清空代码、重命名查重、新增 ↑↓ 快捷排序(批量重排接口)、空代码不再显示占位 2. 修复单人加减分提交空名单:showSinglePointsModal 三处重复定义收口到 points-mgmt 并共享选中状态 3. SMTP:SMTP_FROM 默认取 SMTP_USER、SMTP_ENABLED 兼容 1/yes/on、启动日志打印邮件状态、新增邮件测试接口与按钮(返回真实 SMTP 错误) 4. 密码:加密改为 bcrypt 库直连(修复 passlib 兼容问题)、重置密码不再依赖影响行数、前端统一展示422校验错误 5. 冗余清理:删除未用导入/Schema/函数、死文件 admin.js 与 sanitize.py、重复 escapeHtml、重复CSS、重复脚本加载 6. 修复11个文件被写入的 UTF-8 BOM 7. 文档与版本同步至4.2
This commit is contained in:
1 parent
990f44bf22
commit
1068bc6def
58 files changed
+366
-533
No files matched your search
+23
-51
@@ -11,7 +11,7 @@
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
from typing import Optional, List
|
||||
from datetime import date, datetime
|
||||
from datetime import date
|
||||
|
||||
|
||||
class AddPointsRequest(BaseModel):
|
||||
@@ -22,31 +22,11 @@ class AddPointsRequest(BaseModel):
|
||||
related_type: Optional[str] = Field(default='manual', pattern=r'^(manual|homework|attendance)$', description="关联类型: manual/homework/attendance")
|
||||
|
||||
|
||||
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=2, max_length=50, pattern=r'^[a-zA-Z0-9_\u4e00-\u9fa5]+$', description="登录账号")
|
||||
@@ -57,12 +37,22 @@ class AddAdminRequest(BaseModel):
|
||||
subject_id: Optional[int] = Field(None, gt=0, description="科目ID(科代表需要)")
|
||||
|
||||
|
||||
class AddAdminResponse(BaseModel):
|
||||
"""添加管理员响应"""
|
||||
success: bool
|
||||
username: str
|
||||
password: Optional[str] = None
|
||||
message: str
|
||||
class UpdateAdminRequest(BaseModel):
|
||||
"""更新管理员请求"""
|
||||
real_name: str = Field(..., min_length=1, max_length=50, description="真实姓名")
|
||||
group_id: int = Field(..., gt=0, description="权限组ID")
|
||||
email: Optional[str] = Field(None, max_length=100, description="绑定邮箱(留空解除绑定)")
|
||||
|
||||
|
||||
class PermissionGroupRequest(BaseModel):
|
||||
"""权限组创建/编辑请求"""
|
||||
group_name: str = Field(..., min_length=1, max_length=50, description="权限组名称")
|
||||
description: Optional[str] = Field(None, max_length=255, description="说明")
|
||||
permissions: List[str] = Field(default_factory=list, description="权限项列表")
|
||||
can_add_points: bool = Field(True, description="是否允许加分")
|
||||
max_add_points: Optional[int] = Field(None, ge=1, le=100, description="单次加分上限,不填为无限制")
|
||||
can_subtract_points: bool = Field(True, description="是否允许扣分")
|
||||
max_subtract_points: Optional[int] = Field(None, ge=1, le=100, description="单次扣分上限,不填为无限制")
|
||||
|
||||
|
||||
class AddStudentRequest(BaseModel):
|
||||
@@ -84,29 +74,6 @@ class AddAttendanceRequest(BaseModel):
|
||||
custom_deduction: Optional[int] = Field(default=None, gt=0, le=20, description="自定义扣分值")
|
||||
|
||||
|
||||
class UpdateAdminRequest(BaseModel):
|
||||
"""更新管理员请求"""
|
||||
real_name: str = Field(..., min_length=1, max_length=50, description="真实姓名")
|
||||
group_id: int = Field(..., gt=0, description="权限组ID")
|
||||
email: Optional[str] = Field(None, max_length=100, description="绑定邮箱(留空解除绑定)")
|
||||
|
||||
|
||||
class PermissionGroupRequest(BaseModel):
|
||||
"""权限组创建/编辑请求"""
|
||||
group_name: str = Field(..., min_length=1, max_length=50, description="权限组名称")
|
||||
description: Optional[str] = Field(None, max_length=255, description="说明")
|
||||
permissions: List[str] = Field(default_factory=list, description="权限项列表")
|
||||
can_add_points: bool = Field(True, description="是否允许加分")
|
||||
max_add_points: Optional[int] = Field(None, ge=1, le=100, description="单次加分上限,不填为无限制")
|
||||
can_subtract_points: bool = Field(True, description="是否允许扣分")
|
||||
max_subtract_points: Optional[int] = Field(None, ge=1, le=100, description="单次扣分上限,不填为无限制")
|
||||
|
||||
|
||||
class DeleteAdminRequest(BaseModel):
|
||||
"""删除管理员请求"""
|
||||
user_id: int = Field(..., description="用户ID")
|
||||
|
||||
|
||||
class ResetPasswordRequest(BaseModel):
|
||||
"""重置密码请求"""
|
||||
new_password: str = Field(..., min_length=6, max_length=50, description="新密码")
|
||||
@@ -121,4 +88,9 @@ class UpdateStudentRequest(BaseModel):
|
||||
|
||||
class UnlockUserRequest(BaseModel):
|
||||
"""解除用户登录锁定请求"""
|
||||
username: str = Field(..., min_length=1, max_length=50, description="用户名")
|
||||
username: str = Field(..., min_length=1, max_length=50, description="用户名")
|
||||
|
||||
|
||||
class EmailTestRequest(BaseModel):
|
||||
"""邮件测试请求"""
|
||||
email: str = Field(..., min_length=3, max_length=100, description="接收测试邮件的邮箱")
|
||||
Reference in new issue
Block a user