integralharvestlogic.go 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. code, msg := integralService.IntegralAddService(dat)
  34. fmt.Println(code,msg)
  35. if (code == 1) {
  36. return &integral.AddResp{
  37. Status: true,
  38. Msg: msg,
  39. }, nil
  40. } else {
  41. return &integral.AddResp{
  42. Status: false,
  43. Msg: msg,
  44. }, nil
  45. }
  46. }