getWithdrawalRecord.go 1.4 KB

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