integralguardlogic.go 919 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package logic
  2. import (
  3. "app.yhyue.com/moapp/jyPoints/rpc/integral"
  4. "context"
  5. "app.yhyue.com/moapp/jyPoints/api/internal/svc"
  6. "app.yhyue.com/moapp/jyPoints/api/internal/types"
  7. "github.com/zeromicro/go-zero/core/logx"
  8. )
  9. type IntegralGuardLogic struct {
  10. logx.Logger
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. }
  14. func NewIntegralGuardLogic(ctx context.Context, svcCtx *svc.ServiceContext) IntegralGuardLogic {
  15. return IntegralGuardLogic{
  16. Logger: logx.WithContext(ctx),
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. }
  20. }
  21. func (l *IntegralGuardLogic) IntegralGuard(req types.GuardReq) (*types.Response, error) {
  22. // todo: add your logic here and delete this line
  23. result := &types.Response{}
  24. lsi := l.svcCtx.Integral
  25. resp, err := lsi.IntegralGuard(l.ctx, &integral.Req{
  26. EndDate: req.EndDate,
  27. })
  28. if err != nil {
  29. return nil, err
  30. }
  31. result.Code = resp.Code
  32. result.Message = resp.Message
  33. return result, nil
  34. }