package api import ( "net/http" "strconv" "github.com/gin-gonic/gin" _ "oci-portal/internal/model" // swagger 注解引用 "oci-portal/internal/service" ) // systemLogHandler 处理面板系统操作日志的查询请求。 type systemLogHandler struct { svc *service.SystemLogService } // list 分页倒序返回系统日志,支持路径 / 用户名关键字模糊过滤。 // // @Summary 系统操作日志列表 // @Tags 设置 // @Success 200 {object} pagedResponse[model.SystemLog] "items 与 total" // @Security BearerAuth // @Router /api/v1/system-logs [get] func (h *systemLogHandler) list(c *gin.Context) { page, _ := strconv.Atoi(c.DefaultQuery("page", "1")) pageSize, _ := strconv.Atoi(c.DefaultQuery("pageSize", "20")) items, total, err := h.svc.List(c.Request.Context(), service.SystemLogQuery{ Page: page, PageSize: pageSize, Keyword: c.Query("keyword"), }) if err != nil { respondError(c, err) return } c.JSON(http.StatusOK, gin.H{"items": items, "total": total}) }