integralharvestlogic.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package logic
  2. import (
  3. "context"
  4. "fmt"
  5. "points_service/entity"
  6. "points_service/rpc/integral"
  7. "points_service/rpc/internal/svc"
  8. "github.com/tal-tech/go-zero/core/logx"
  9. )
  10. type IntegralHarvestLogic struct {
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. logx.Logger
  14. }
  15. func NewIntegralHarvestLogic(ctx context.Context, svcCtx *svc.ServiceContext) *IntegralHarvestLogic {
  16. return &IntegralHarvestLogic{
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. Logger: logx.WithContext(ctx),
  20. }
  21. }
  22. // 收获积分
  23. func (l *IntegralHarvestLogic) IntegralHarvest(in *integral.AddReq) (*integral.AddResp, error) {
  24. dat := entity.FlowJSON{}
  25. dat.PointType = 1
  26. dat.BusinessTypeId = 1
  27. dat.BusinessType = "1"
  28. dat.EndDate = "2021-03-10"
  29. dat.AppId = 10000
  30. dat.OperationType = false
  31. dat.UserId=in.UserId
  32. dat.Point=in.CountPoints
  33. dat.Sort=entity.AddCode
  34. code, msg := integralService.IntegralAddService(dat)
  35. fmt.Println(code,msg)
  36. if (code == 1) {
  37. return &integral.AddResp{
  38. Status: true,
  39. Msg: msg,
  40. }, nil
  41. } else {
  42. return &integral.AddResp{
  43. Status: false,
  44. Msg: msg,
  45. }, nil
  46. }
  47. }