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