integralharvestlogic.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package logic
  2. import (
  3. "app.yhyue.com/moapp/jyPoints/api/internal/svc"
  4. "app.yhyue.com/moapp/jyPoints/api/internal/types"
  5. "app.yhyue.com/moapp/jyPoints/rpc/integral"
  6. "context"
  7. "github.com/zeromicro/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. SourceType: req.SourceType,
  31. SourceId: req.SourceId,
  32. Point: req.Point,
  33. PointType: req.PointType,
  34. Abstract: req.Abstract,
  35. OperationType: req.OperationType,
  36. })
  37. if err != nil {
  38. return nil, err
  39. }
  40. result.Code = resp.Code
  41. result.Message = resp.Message
  42. result.SerialNumber = resp.SerialNumber
  43. return result, nil
  44. }