This commit is contained in:
2026-09-03 17:55:42 +08:00
parent 7c38e84e30
commit c80a3d4a2d
35 changed files with 6795 additions and 597 deletions
+5 -1
View File
@@ -35,7 +35,11 @@ func (h *ClassHandler) Create(c *gin.Context) {
// Detail GET /api/classes/:id
func (h *ClassHandler) Detail(c *gin.Context) {
id, _ := strconv.ParseUint(c.Param("id"), 10, 64)
id, err := strconv.ParseUint(c.Param("id"), 10, 64)
if err != nil || id == 0 {
response.BadRequest(c, "无效的班级ID")
return
}
userID := middleware.CurrentUserID(c)
isSuperAdmin := middleware.CurrentRole(c) == "admin"
detail, err := h.svc.GetDetail(uint(id), userID, isSuperAdmin)