跨域bug修复2

This commit is contained in:
2026-04-14 15:56:57 +08:00
parent 74053bdbdc
commit fd3535f884
14 changed files with 65 additions and 65 deletions

View File

@@ -133,9 +133,7 @@ class ConductService:
# 班主任/班长可查看全班
if role in ["班主任", "班长"]:
user_class = await PermissionChecker.get_user_class_id(user_id)
records = await ConductModel.get_all_records(
class_id=user_class,
limit=page_size,
offset=offset,
start_date=start_date,
@@ -147,16 +145,13 @@ class ConductService:
count_sql = """
SELECT COUNT(*) as total FROM conduct_records cr
JOIN students s ON cr.student_id = s.student_id
WHERE s.class_id = %s AND cr.is_revoked = 0
WHERE cr.is_revoked = 0
"""
total_result = await execute_one(count_sql, (user_class,))
total_result = await execute_one(count_sql)
total = total_result["total"] if total_result else 0
elif student_id:
# 查看指定学生(需权限验证)
can_manage = await PermissionChecker.check_can_manage_student(user_id, student_id)
if not can_manage:
return {"error": "无权查看该学生记录"}
# 管理员可查看指定学生
records = await ConductModel.get_student_records(
student_id=student_id,