getwithdrawinfo.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package handler
  2. import (
  3. "fmt"
  4. "github.com/gin-gonic/gin"
  5. "github.com/sirupsen/logrus"
  6. "youngee_m_api/consts"
  7. "youngee_m_api/db"
  8. "youngee_m_api/model/http_model"
  9. "youngee_m_api/util"
  10. )
  11. func WrapGetWithDrawInfoHandler(ctx *gin.Context) {
  12. handler := newGetWithDrawInfoHandler(ctx)
  13. BaseRun(handler)
  14. }
  15. type GetWithDrawInfoHandler struct {
  16. ctx *gin.Context
  17. req *http_model.GetWithDrawInfoRequest
  18. resp *http_model.CommonResponse
  19. }
  20. func (g GetWithDrawInfoHandler) getContext() *gin.Context {
  21. return g.ctx
  22. }
  23. func (g GetWithDrawInfoHandler) getResponse() interface{} {
  24. return g.resp
  25. }
  26. func (g GetWithDrawInfoHandler) getRequest() interface{} {
  27. return g.req
  28. }
  29. func (g GetWithDrawInfoHandler) run() {
  30. req := g.req
  31. fmt.Println(req.Withdrawid)
  32. data, err := db.GetWithDrawInfo(g.ctx, *req)
  33. if err != nil {
  34. logrus.WithContext(g.ctx).Errorf("[GetWithDrawInfoHandler] error GetWithDrawInfo, err:%+v", err)
  35. util.HandlerPackErrorResp(g.resp, consts.ErrorInternal, consts.DefaultToast)
  36. return
  37. }
  38. g.resp.Data = data
  39. g.resp.Status = consts.ErrorSuccess
  40. g.resp.Message = "成功查询"
  41. }
  42. func (g GetWithDrawInfoHandler) checkParam() error {
  43. return nil
  44. }
  45. func newGetWithDrawInfoHandler(ctx *gin.Context) *GetWithDrawInfoHandler {
  46. return &GetWithDrawInfoHandler{
  47. ctx: ctx,
  48. req: http_model.NewGetWithDrawInfoRequest(),
  49. resp: http_model.NewGetWithDrawInfoResponse(),
  50. }
  51. }