package label import ( "github.com/gin-gonic/gin" "product/backend/handlers/base" "product/backend/models" ) // 请求结构体 type PostReq struct { models.Label EntityType string `json:"entityType" binding:"oneof=competition"` } type PutReq struct { ID uint `json:"id" binding:"required"` EntityType string `json:"entityType" binding:"oneof='competition' ''"` models.Label } type GetReq struct { base.GetReq EntityType string `form:"entityType" binding:"oneof=competition"` EntityID uint `form:"entityID"` WithLabelValue bool `form:"withLabelValue"` } func (getReq *GetReq) BindAndInit(ctx *gin.Context) error { if err := ctx.ShouldBindQuery(&getReq); err != nil { return err } getReq.GetReq.Init() return nil } type DelReq struct { base.DelReq }