package api import ( "github.com/gin-gonic/gin" "online_code/core" "online_code/models/param" "online_code/repository" ) type submitApi struct{} func SubmitApi() *submitApi { return &submitApi{} } func (submitApi) GetSubmitList(c *gin.Context) { var p param.GetSubmitList if err := c.ShouldBind(&p); err != nil { core.R(c).FailWithMessage("参数错误: " + err.Error()) return } records, count, err := repository.SubmitService().GetList(p) if err != nil { core.R(c).FailWithMessage("获取提交列表失败: " + err.Error()) return } // 返回结果 core.R(c).OkDataPage(count, core.PageData{Current: p.Current, Size: p.Size, Total: count, Records: records}) }