integralconsumelogic.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package logic
  2. import (
  3. "context"
  4. "app.yhyue.com/moapp/jyPoints/entity"
  5. "app.yhyue.com/moapp/jyPoints/service"
  6. "app.yhyue.com/moapp/jyPoints/rpc/integral"
  7. "app.yhyue.com/moapp/jyPoints/rpc/internal/svc"
  8. "github.com/tal-tech/go-zero/core/logx"
  9. )
  10. type IntegralConsumeLogic struct {
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. logx.Logger
  14. }
  15. var (
  16. integralService = &service.IntegralService{}
  17. )
  18. func NewIntegralConsumeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *IntegralConsumeLogic {
  19. return &IntegralConsumeLogic{
  20. ctx: ctx,
  21. svcCtx: svcCtx,
  22. Logger: logx.WithContext(ctx),
  23. }
  24. }
  25. // 消耗积分
  26. func (l *IntegralConsumeLogic) IntegralConsume(in *integral.Req) (*integral.Resp, error) {
  27. // todo: add your logic here and delete this line
  28. result := &integral.Resp{}
  29. dat := entity.FlowJSON{}
  30. dat.UserId = in.UserId
  31. dat.PointType = in.PointType
  32. dat.BusinessTypeId = in.BusinessTypeId
  33. dat.BusinessType = in.BusinessType
  34. dat.Point = in.Point
  35. dat.EndDate = in.EndDate
  36. dat.AppId = in.AppId
  37. code,msg := integralService.IntegralConsumeService(dat)
  38. result.Code = code
  39. result.Message = msg
  40. return result,nil
  41. }