statusoplogic.go 778 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package logic
  2. import (
  3. "context"
  4. "net/http"
  5. "dag-jupyter/internal/api"
  6. "dag-jupyter/internal/svc"
  7. "dag-jupyter/internal/types"
  8. "github.com/zeromicro/go-zero/core/logx"
  9. )
  10. type StatusOpLogic struct {
  11. logx.Logger
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. }
  15. func NewStatusOpLogic(ctx context.Context, svcCtx *svc.ServiceContext) *StatusOpLogic {
  16. return &StatusOpLogic{
  17. Logger: logx.WithContext(ctx),
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. }
  21. }
  22. func (l *StatusOpLogic) StatusOp(req *types.ReleaseInfo) (resp *types.Response, err error) {
  23. data, err := api.Status(req)
  24. if err != nil {
  25. return &types.Response{
  26. Data: []*types.ReleaseStatus{},
  27. Code: http.StatusBadRequest,
  28. }, err
  29. }
  30. return &types.Response{
  31. Data: data,
  32. Code: http.StatusOK,
  33. }, nil
  34. }