package handler import ( "github.com/gin-gonic/gin" "github.com/sirupsen/logrus" "youngee_b_api/consts" "youngee_b_api/model/http_model" "youngee_b_api/service" "youngee_b_api/util" ) func WrapFindKuaishouProductHandler(ctx *gin.Context) { handler := newFindKuaishouProductHandler(ctx) baseRun(handler) } func newFindKuaishouProductHandler(ctx *gin.Context) *FindKuaishouProductHandler { return &FindKuaishouProductHandler{ req: http_model.NewFindKuaishouProductRequest(), resp: http_model.NewFindKuaishouProductResponse(), ctx: ctx, } } type FindKuaishouProductHandler struct { req *http_model.FindKuaishouProductRequest resp *http_model.CommonResponse ctx *gin.Context } func (h *FindKuaishouProductHandler) getRequest() interface{} { return h.req } func (h *FindKuaishouProductHandler) getContext() *gin.Context { return h.ctx } func (h *FindKuaishouProductHandler) getResponse() interface{} { return h.resp } func (h *FindKuaishouProductHandler) run() { data := *&http_model.FindKuaishouProductRequest{} data = *h.req // print("data: ", data.ItemList) res, err := service.Product.QueryKuaishouProduct(h.ctx, data) if err != nil { logrus.WithContext(h.ctx).Errorf("[FindKuaishouProductHandler] error FindKuaishouProductHandler, err:%+v", err) util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, consts.DefaultToast) h.resp.Message = err.Error() return } h.resp.Status = 20000 h.resp.Message = "成功查询" h.resp.Data = res } func (h *FindKuaishouProductHandler) checkParam() error { return nil }