1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- 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 WrapGetInvoiceValueHandler(ctx *gin.Context) {
- handler := newGetInvoiceValueHandler(ctx)
- BaseRun(handler)
- }
- type GetInvoiceValueHandler struct {
- ctx *gin.Context
- req *http_model.GetInvoiceValueRequest
- resp *http_model.CommonResponse
- }
- func (g GetInvoiceValueHandler) getContext() *gin.Context {
- return g.ctx
- }
- func (g GetInvoiceValueHandler) getResponse() interface{} {
- return g.resp
- }
- func (g GetInvoiceValueHandler) getRequest() interface{} {
- return g.req
- }
- func (g GetInvoiceValueHandler) run() {
- req := g.req
- data, err := db.GetInvoiceValue(g.ctx, *req)
- if err != nil {
- logrus.WithContext(g.ctx).Errorf("[GetInvoiceValueHandler] error GetInvoiceValue, err:%+v", err)
- util.HandlerPackErrorResp(g.resp, consts.ErrorInternal, consts.DefaultToast)
- return
- }
- g.resp.Data = data
- }
- func (g GetInvoiceValueHandler) checkParam() error {
- return nil
- }
- func newGetInvoiceValueHandler(ctx *gin.Context) *GetInvoiceValueHandler {
- return &GetInvoiceValueHandler{
- ctx: ctx,
- req: http_model.NewGetInvoiceValueRequest(),
- resp: http_model.NewGetInvoiceValueResponse(),
- }
- }
|