v0.7.2测试

This commit is contained in:
2026-04-15 12:36:37 +08:00
parent 3ba87367df
commit 7c743293be
5 changed files with 77 additions and 33 deletions

View File

@@ -31,19 +31,23 @@ async def get_conduct_history(
"""
获取学生操行分历史
"""
user = await get_current_user(request)
# 权限检查:只能查看自己的信息(学生)或同班(管理员)
if user["user_type"] == "student" and user["student_id"] != student_id:
return error_response(message="无权查看其他学生信息", code=403)
result = await StudentService.get_conduct_history(
student_id=student_id,
limit=limit,
offset=offset
)
return success_response(data=result)
try:
user = await get_current_user(request)
# 权限检查:只能查看自己的信息(学生)或同班(管理员)
if user["user_type"] == "student" and user["student_id"] != student_id:
return error_response(message="无权查看其他学生信息", code=403)
result = await StudentService.get_conduct_history(
student_id=student_id,
limit=limit,
offset=offset
)
return success_response(data=result)
except Exception as e:
logger.error(f"获取学生操行分失败: {e}", exc_info=True)
return error_response(message=f"获取学生操行分失败: {str(e)}", code=500)
@router.get("/homework/{student_id}")