package handler import ( "errors" "fmt" "github.com/gin-gonic/gin" "youngee_b_api/model/http_model" ) func WrapGetAllSelectionHandler(ctx *gin.Context) { handler := newGetAllSelectionHandler(ctx) baseRun(handler) } type AllSelectionHandler struct { ctx *gin.Context req *http_model.GetAllSelectionRequest resp *http_model.CommonResponse } func (a AllSelectionHandler) getContext() *gin.Context { return a.ctx } func (a AllSelectionHandler) getResponse() interface{} { return a.resp } func (a AllSelectionHandler) getRequest() interface{} { return a.req } func (a AllSelectionHandler) run() { } func (a AllSelectionHandler) checkParam() error { var errs []error if a.req.PageNum < 0 || a.req.PageSize <= 0 { errs = append(errs, errors.New("page param error")) } a.req.PageNum-- if len(errs) != 0 { return fmt.Errorf("check param errs:%+v", errs) } return nil } func newGetAllSelectionHandler(ctx *gin.Context) *AllSelectionHandler { return &AllSelectionHandler{ ctx: ctx, req: http_model.NewGetAllSelectionRequest(), resp: http_model.NewGetAllSelectionResponse(), } }