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 WrapGetInvoiceListHandler(ctx *gin.Context) { handler := newGetInvoiceListHandler(ctx) BaseRun(handler) } type GetInvoiceList struct { ctx *gin.Context req *http_model.GetInvoiceListRequest resp *http_model.CommonResponse } func (c GetInvoiceList) getContext() *gin.Context { return c.ctx } func (c GetInvoiceList) getResponse() interface{} { return c.resp } func (c GetInvoiceList) getRequest() interface{} { return c.req } func (c GetInvoiceList) run() { data := http_model.GetInvoiceListRequest{} data = *c.req res, err := db.GetInvoiceList(c.ctx, data) if err != nil { logrus.Errorf("[GetInvoiceList] call GetInvoiceList err:%+v\n", err) util.HandlerPackErrorResp(c.resp, consts.ErrorInternal, "") logrus.Info("GetInvoiceList fail,req:%+v", c.req) return } c.resp.Message = "成功查询开票列表" c.resp.Data = res } func (c GetInvoiceList) checkParam() error { return nil } func newGetInvoiceListHandler(ctx *gin.Context) *GetInvoiceList { return &GetInvoiceList{ ctx: ctx, req: http_model.NewGetInvoiceListRequest(), resp: http_model.NewGetInvoiceListResponse(), } }