integralconsumelogic.go 1.0 KB

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