deletedomainlogic.go 886 B

1234567891011121314151617181920212223242526272829303132333435
  1. package logic
  2. import (
  3. "app.yhyue.com/moapp/jyfs/api/internal/svc"
  4. "app.yhyue.com/moapp/jyfs/api/internal/types"
  5. "context"
  6. fsc "app.yhyue.com/moapp/jyfs/rpc/filesystemclient"
  7. "github.com/tal-tech/go-zero/core/logx"
  8. )
  9. type DeleteDomainLogic struct {
  10. logx.Logger
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. }
  14. func NewDeleteDomainLogic(ctx context.Context, svcCtx *svc.ServiceContext) DeleteDomainLogic {
  15. return DeleteDomainLogic{
  16. Logger: logx.WithContext(ctx),
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. }
  20. }
  21. func (l *DeleteDomainLogic) DeleteDomain(req types.LoadDomainReq) (*types.DomainOpResp, error) {
  22. resp, err := l.svcCtx.FileSystem.DeleteDomain(l.ctx, &fsc.DomainReq{
  23. Name: req.Name,
  24. })
  25. if err != nil || (resp != nil && !resp.State) {
  26. return &types.DomainOpResp{State: "删除失败"}, nil
  27. } else {
  28. return &types.DomainOpResp{State: "删除成功"}, nil
  29. }
  30. }