123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- 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 WrapGetRechargeInfoHandler(ctx *gin.Context) {
- handler := newGetRechargeInfoHandler(ctx)
- BaseRun(handler)
- }
- type GetRechargeInfoHandler struct {
- ctx *gin.Context
- req *http_model.GetRechargeInfoRequest
- resp *http_model.CommonResponse
- }
- func (g GetRechargeInfoHandler) getContext() *gin.Context {
- return g.ctx
- }
- func (g GetRechargeInfoHandler) getResponse() interface{} {
- return g.resp
- }
- func (g GetRechargeInfoHandler) getRequest() interface{} {
- return g.req
- }
- func (g GetRechargeInfoHandler) run() {
- req := g.req
- data, err := db.GetRechargeInfo(g.ctx, *req)
- if err != nil {
- logrus.WithContext(g.ctx).Errorf("[GetRechargeInfoHandler] error GetRechargeInfo, err:%+v", err)
- util.HandlerPackErrorResp(g.resp, consts.ErrorInternal, consts.DefaultToast)
- return
- }
- g.resp.Data = data
- g.resp.Status = consts.ErrorSuccess
- }
- func (g GetRechargeInfoHandler) checkParam() error {
- return nil
- }
- func newGetRechargeInfoHandler(ctx *gin.Context) *GetRechargeInfoHandler {
- return &GetRechargeInfoHandler{
- ctx: ctx,
- req: http_model.NewGetRechargeInfoRequest(),
- resp: http_model.NewGetRechargeInfoResponse(),
- }
- }
|