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 WrapConfirmSupplierInvoiceHandler(ctx *gin.Context) { handler := newConfirmSupplierInvoiceHandler(ctx) BaseRun(handler) } type ConfirmSupplierInvoiceHandler struct { ctx *gin.Context req *http_model.ConfirmSupplierInvoiceRequest resp *http_model.CommonResponse } func (c ConfirmSupplierInvoiceHandler) getContext() *gin.Context { return c.ctx } func (c ConfirmSupplierInvoiceHandler) getResponse() interface{} { return c.resp } func (c ConfirmSupplierInvoiceHandler) getRequest() interface{} { return c.req } func (c ConfirmSupplierInvoiceHandler) run() { err := db.ConfirmSupplierInvoice(c.ctx, c.req) if err != nil { // 数据库查询失败,返回5001 logrus.Errorf("[ConfirmSupplierInvoiceHandler] call ConfirmSupplierInvoice err:%+v\n", err) util.HandlerPackErrorResp(c.resp, consts.ErrorInternal, "") logrus.Info("ConfirmSupplierInvoice fail,req:%+v", c.req) return } c.resp.Message = "确认开票成功" } func (c ConfirmSupplierInvoiceHandler) checkParam() error { return nil } func newConfirmSupplierInvoiceHandler(ctx *gin.Context) *ConfirmSupplierInvoiceHandler { return &ConfirmSupplierInvoiceHandler{ ctx: ctx, req: http_model.NewConfirmSupplierInvoiceRequest(), resp: http_model.NewConfirmSupplierInvoiceResponse(), } }