integralharvestlogic.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package logic
  2. import (
  3. "context"
  4. "app.yhyue.com/moapp/jyPoints/rpc/integral"
  5. "app.yhyue.com/moapp/jyPoints/api/internal/svc"
  6. "app.yhyue.com/moapp/jyPoints/api/internal/types"
  7. "github.com/tal-tech/go-zero/core/logx"
  8. )
  9. type IntegralHarvestLogic struct {
  10. logx.Logger
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. }
  14. func NewIntegralHarvestLogic(ctx context.Context, svcCtx *svc.ServiceContext) IntegralHarvestLogic {
  15. return IntegralHarvestLogic{
  16. Logger: logx.WithContext(ctx),
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. }
  20. }
  21. //新增积分
  22. func (l *IntegralHarvestLogic) IntegralHarvest(req types.AddReq) (*types.AddResp, error) {
  23. // todo: add your logic here and delete this line
  24. result := &types.AddResp{}
  25. lsi := l.svcCtx.Integral
  26. resp, err := lsi.IntegralHarvest(l.ctx, &integral.Req{
  27. UserId: req.UserId,
  28. AppId: req.AppId,
  29. EndDate: req.EndDate,
  30. BusinessType: req.BusinessType,
  31. BusinessTypeId: req.BusinessTypeId,
  32. Point: req.Point,
  33. PointType: req.PointType,
  34. OperationType: req.OperationType,
  35. })
  36. if err != nil {
  37. return nil, err
  38. }
  39. result.Code = resp.Code
  40. result.Message = resp.Message
  41. return result, nil
  42. }