getWithdrawalRecord.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 WrapGetWithdrawalRecordHandler(ctx *gin.Context) {
  12. handler := newGetWithdrawalRecordHandler(ctx)
  13. BaseRun(handler)
  14. }
  15. type GetWithdrawalRecordHandler struct {
  16. ctx *gin.Context
  17. req *http_model.GetWithdrawalRecordRequest
  18. resp *http_model.CommonResponse
  19. }
  20. func (g GetWithdrawalRecordHandler) getContext() *gin.Context {
  21. return g.ctx
  22. }
  23. func (g GetWithdrawalRecordHandler) getResponse() interface{} {
  24. return g.resp
  25. }
  26. func (g GetWithdrawalRecordHandler) getRequest() interface{} {
  27. return g.req
  28. }
  29. func (g GetWithdrawalRecordHandler) run() {
  30. fmt.Println("talentId1:", g.req.TalentId)
  31. data, err := db.GetWithdrawRecord(g.ctx, g.req)
  32. if err != nil {
  33. logrus.WithContext(g.ctx).Errorf("[GetWithdrawalRecordHandler] error GetWithdrawRecord, err:%+v", err)
  34. util.HandlerPackErrorResp(g.resp, consts.ErrorInternal, consts.DefaultToast)
  35. return
  36. }
  37. g.resp.Data = data
  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. }