package handler import ( "github.com/gin-gonic/gin" "youngee_b_api/model/http_model" "youngee_b_api/service" ) func WrapInvoiceAmountHandler(ctx *gin.Context) { handler := newInvoiceAmountHandler(ctx) baseRun(handler) } func newInvoiceAmountHandler(ctx *gin.Context) *InvoiceAmountHandler { return &InvoiceAmountHandler{ req: http_model.NewInvoiceAmountRequest(), resp: http_model.NewInvoiceAmountResponse(), ctx: ctx, } } type InvoiceAmountHandler struct { req *http_model.InvoiceAmountRequest resp *http_model.CommonResponse ctx *gin.Context } func (h *InvoiceAmountHandler) getRequest() interface{} { return h.req } func (h *InvoiceAmountHandler) getContext() *gin.Context { return h.ctx } func (h *InvoiceAmountHandler) getResponse() interface{} { return h.resp } func (h *InvoiceAmountHandler) run() { amount, err := service.Supplier.GetSupplierInvoiceAmount(h.ctx, h.req) if err != nil { h.resp.Status = 40000 h.resp.Message = err.Error() return } h.resp.Data = amount h.resp.Message = "成功添加" } func (h *InvoiceAmountHandler) checkParam() error { return nil }