pinglogic.go 636 B

1234567891011121314151617181920212223242526272829303132
  1. package logic
  2. import (
  3. "context"
  4. "git.i2edu.net/i2/i2-bill-erp/internal/svc"
  5. "git.i2edu.net/i2/i2-bill-erp/transform"
  6. "git.i2edu.net/i2/go-zero/core/logx"
  7. )
  8. type PingLogic struct {
  9. ctx context.Context
  10. svcCtx *svc.ServiceContext
  11. logx.Logger
  12. }
  13. func NewPingLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PingLogic {
  14. return &PingLogic{
  15. ctx: ctx,
  16. svcCtx: svcCtx,
  17. Logger: logx.WithContext(ctx),
  18. }
  19. }
  20. func (l *PingLogic) Ping(in *transform.Request) (*transform.Response, error) {
  21. res, err := l.svcCtx.Model.FindOne(in.Id)
  22. if err != nil {
  23. return nil, err
  24. }
  25. return &transform.Response{Id: res.Id}, nil
  26. }