package handler import ( "github.com/gin-gonic/gin" "github.com/sirupsen/logrus" "youngee_m_api/consts" "youngee_m_api/db" "youngee_m_api/model/http_model" "youngee_m_api/util" ) func WrapGetInvoiceInfoHandler(ctx *gin.Context) { handler := newGetInvoiceInfoHandler(ctx) BaseRun(handler) } type GetInvoiceInfoHandler struct { ctx *gin.Context req *http_model.GetInvoiceInfoRequest resp *http_model.CommonResponse } func (g GetInvoiceInfoHandler) getContext() *gin.Context { return g.ctx } func (g GetInvoiceInfoHandler) getResponse() interface{} { return g.resp } func (g GetInvoiceInfoHandler) getRequest() interface{} { return g.req } func (g GetInvoiceInfoHandler) run() { req := g.req data, err := db.GetInvoiceInfo(g.ctx, *req) if err != nil { logrus.WithContext(g.ctx).Errorf("[GetInvoiceInfoHandler] error GetInvoiceInfo, err:%+v", err) util.HandlerPackErrorResp(g.resp, consts.ErrorInternal, consts.DefaultToast) return } g.resp.Data = data } func (g GetInvoiceInfoHandler) checkParam() error { return nil } func newGetInvoiceInfoHandler(ctx *gin.Context) *GetInvoiceInfoHandler { return &GetInvoiceInfoHandler{ ctx: ctx, req: http_model.NewGetInvoiceInfoRequest(), resp: http_model.NewGetInvoiceInfoResponse(), } }