package handler import ( "github.com/gin-gonic/gin" "youngee_b_api/model/http_model" "youngee_b_api/service" ) func WrapInvoiceCountHandler(ctx *gin.Context) { handler := newInvoiceCountHandler(ctx) baseRun(handler) } func newInvoiceCountHandler(ctx *gin.Context) *InvoiceCountHandler { return &InvoiceCountHandler{ req: http_model.NewInvoiceCountRequest(), resp: http_model.NewInvoiceCountResponse(), ctx: ctx, } } type InvoiceCountHandler struct { req *http_model.InvoiceCountRequest resp *http_model.CommonResponse ctx *gin.Context } func (h *InvoiceCountHandler) getRequest() interface{} { return h.req } func (h *InvoiceCountHandler) getContext() *gin.Context { return h.ctx } func (h *InvoiceCountHandler) getResponse() interface{} { return h.resp } func (h *InvoiceCountHandler) run() { count, err := service.Supplier.GetSupplierInvoiceCount(h.ctx, h.req) if err != nil { h.resp.Status = 40000 h.resp.Message = err.Error() return } h.resp.Data = count h.resp.Status = 20000 h.resp.Message = "ok" } func (h *InvoiceCountHandler) checkParam() error { return nil }