v0.8测试

This commit is contained in:
2026-04-16 07:55:46 +08:00
parent 7c743293be
commit c8262cf92e
16 changed files with 84 additions and 39 deletions

View File

@@ -194,7 +194,7 @@ async def get_conduct_history(
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)
return error_response(message=f"获取历史记录失败: {str(e)}")
# ========== 作业管理 ==========
@@ -299,7 +299,8 @@ async def add_attendance(request: Request, req: AddAttendanceRequest):
status=req.status,
reason=req.reason,
apply_deduction=req.apply_deduction,
recorder_id=user["user_id"]
recorder_id=user["user_id"],
custom_deduction=req.custom_deduction
)
if result["success"]:
await LogService.write_operation_log(
@@ -339,7 +340,7 @@ async def add_admin(request: Request, req: AddAdminRequest):
is_teacher = await PermissionChecker.check_is_teacher(user["user_id"])
if not is_teacher:
return error_response(message="仅班主任可添加管理员", code=403)
if req.role_type not in ["班长", "学习委员", "考勤委员", "劳动委员"]:
if req.role_type not in ["班长", "学习委员", "考勤委员", "劳动委员", "志愿委员"]:
return error_response(message="无效的角色类型", code=400)
result = await AdminService.add_admin(
username=req.username,
@@ -373,4 +374,4 @@ async def get_admins(request: Request):
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)
return error_response(message=f"获取管理员列表失败: {str(e)}")