0841b1a103
- 前端:Vue3 + TS + Element Plus,24 个页面路由(课件/组题/教案/动画/思维导图/作文批改/命题/课堂/资源/社区等) - 后端:FastAPI + SQLAlchemy + SQLite,17 个路由模块,AI 服务层含降级模板 - AI:glm-5.x 推理模型已禁用思维链,确保输出真实内容 - 修复:ai_service 两处请求体注入 enable_thinking/thinking disabled - 测试账号:13900999999 / test1234
54 lines
1.3 KiB
Python
54 lines
1.3 KiB
Python
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
from pydantic import BaseModel, Field, field_validator
|
|
|
|
|
|
class AdminUserOut(BaseModel):
|
|
id: int
|
|
phone: str
|
|
name: str
|
|
avatar: str = ""
|
|
subject: str = ""
|
|
school: str = ""
|
|
grade: str = ""
|
|
role: str = "teacher"
|
|
is_active: bool = True
|
|
credits: int = 0
|
|
created_at: datetime | None = None
|
|
|
|
@field_validator("avatar", "subject", "school", "grade", "name", "role", mode="before")
|
|
@classmethod
|
|
def _none_to_empty(cls, v):
|
|
return "" if v is None else v
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class AdminUserUpdate(BaseModel):
|
|
role: Optional[str] = None
|
|
is_active: Optional[bool] = None
|
|
name: Optional[str] = None
|
|
|
|
|
|
class AdminGrantCredits(BaseModel):
|
|
amount: int = Field(..., gt=0, le=10000, description="积分数量")
|
|
|
|
|
|
class AdminDashboardOut(BaseModel):
|
|
total_users: int = 0
|
|
active_users: int = 0
|
|
admin_users: int = 0
|
|
total_resources: int = 0
|
|
public_resources: int = 0
|
|
total_coursewares: int = 0
|
|
total_animations: int = 0
|
|
total_exercises: int = 0
|
|
total_lesson_plans: int = 0
|
|
total_exams: int = 0
|
|
total_views: int = 0
|
|
total_downloads: int = 0
|
|
total_favorites: int = 0
|
|
total_credits_used: int = 0
|
|
new_users_today: int = 0
|