deletedomainlogic.go 846 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package logic
  2. import (
  3. "context"
  4. "app.yhyue.com/moapp/jyfs/rpc/internal/redis"
  5. "app.yhyue.com/moapp/jyfs/rpc/filesystem"
  6. "app.yhyue.com/moapp/jyfs/rpc/internal/svc"
  7. "github.com/tal-tech/go-zero/core/logx"
  8. )
  9. type DeleteDomainLogic struct {
  10. ctx context.Context
  11. svcCtx *svc.ServiceContext
  12. logx.Logger
  13. }
  14. func NewDeleteDomainLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteDomainLogic {
  15. return &DeleteDomainLogic{
  16. ctx: ctx,
  17. svcCtx: svcCtx,
  18. Logger: logx.WithContext(ctx),
  19. }
  20. }
  21. // 删除域
  22. func (l *DeleteDomainLogic) DeleteDomain(in *filesystem.DomainReq) (*filesystem.DomainResp, error) {
  23. err := l.svcCtx.OssClient.DeleteBucket(in.Name)
  24. if err != nil {
  25. return &filesystem.DomainResp{State: false}, nil
  26. } else {
  27. redis.Del("jyfs", "jyfs_"+in.Name)
  28. return &filesystem.DomainResp{State: true}, nil
  29. }
  30. }