package handler import ( "cicv-data-closedloop/amd64/web_server/entity" "cicv-data-closedloop/common/config/c_log" commonEntity "cicv-data-closedloop/common/entity" "cicv-data-closedloop/common/util" "github.com/gin-gonic/gin" "net/http" ) type ReportRequest struct { Page commonEntity.PageRequest Team string `json:"team"` Topic string `json:"topic"` } // Page 分页查询 func Page(c *gin.Context) { param := new(commonEntity.PageRequest) // 映射到结构体 if err := c.ShouldBindJSON(¶m); err != nil { c_log.GlobalLogger.Error("项目启动接收请求参数报错:", err) c.JSON(http.StatusBadRequest, commonEntity.Response{ Code: 500, Msg: "请求体解析失败。", }) return } var result []entity.Record for i := 0; i < param.PageSize; i++ { result = append(result, entity.Record{ Team: "team" + util.NewShortUUID(), Topic: "topic" + util.NewShortUUID(), ScoreOnline: 100.0, ScoreOffline: 100.0, ScoreFinal: 100.0, Details: "sdlkfjsaljfldsakjfkls", }) } c.JSON(http.StatusOK, commonEntity.Response{ Code: 200, Msg: "分页查询成功。", Data: result, }) }