integraldetailedchecklogic.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. package logic
  2. import (
  3. "app.yhyue.com/moapp/jyPoints/rpc/integral"
  4. "context"
  5. "app.yhyue.com/moapp/jyPoints/api/internal/svc"
  6. "app.yhyue.com/moapp/jyPoints/api/internal/types"
  7. "github.com/zeromicro/go-zero/core/logx"
  8. )
  9. type IntegralDetailedCheckLogic struct {
  10. logx.Logger
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. }
  14. func NewIntegralDetailedCheckLogic(ctx context.Context, svcCtx *svc.ServiceContext) IntegralDetailedCheckLogic {
  15. return IntegralDetailedCheckLogic{
  16. Logger: logx.WithContext(ctx),
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. }
  20. }
  21. // 按月查询积分明细
  22. func (l *IntegralDetailedCheckLogic) IntegralDetailedCheck(req types.DetailedReq) (*types.RespList, error) {
  23. // todo: add your logic here and delete this line
  24. result := &types.RespList{}
  25. lsi := l.svcCtx.Integral
  26. resp, err := lsi.IntegralDetailedCheck(l.ctx, &integral.Req{
  27. UserId: req.UserId,
  28. AppId: req.AppId,
  29. PageSize: req.PageSize,
  30. Page: req.Page,
  31. SearchType: req.SearchType,
  32. })
  33. if err != nil {
  34. return nil, err
  35. }
  36. result.Count = resp.Count
  37. data := []*types.Point{}
  38. for _, value := range resp.Data {
  39. point := types.Point{}
  40. point.EndDate = value.EndDate
  41. point.Sort = value.Sort
  42. point.Point = value.Point
  43. point.CreateTime = value.CreateTime
  44. point.PointType = value.PointType
  45. point.SourceId = value.SourceId
  46. point.SourceType = value.SourceType
  47. point.Name = value.Name
  48. point.Abstract = value.Abstract
  49. point.SerialNumber = value.SerialNumber
  50. data = append(data, &point)
  51. }
  52. result.Data = data
  53. result.Code = resp.Code
  54. result.Message = resp.Message
  55. return result, nil
  56. }