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