package logic import ( "context" "strings" "app.yhyue.com/moapp/jyfs/api/internal/svc" "app.yhyue.com/moapp/jyfs/api/internal/types" fsc "app.yhyue.com/moapp/jyfs/rpc/filesystemclient" "github.com/zeromicro/go-zero/core/logx" ) type CreateDomainLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } func NewCreateDomainLogic(ctx context.Context, svcCtx *svc.ServiceContext) CreateDomainLogic { return CreateDomainLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, } } func (l *CreateDomainLogic) CreateDomain(req types.CreateDomainReq) (*types.DomainOpResp, error) { // todo: add your logic here and delete this line resp, err := l.svcCtx.FileSystem.CreateDomain(l.ctx, &fsc.DomainReq{ Name: req.Name, MetaFields: strings.Split(req.Meta, ","), }) if err != nil || (resp != nil && !resp.State) { return &types.DomainOpResp{State: "创建失败"}, err } else { return &types.DomainOpResp{State: "创建成功"}, nil } }