package ai import ( "context" "github.com/jinzhu/copier" error2 "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/repository/error" "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/utils" "gitlink.org.cn/jcce-pcm/pcm-participant-modelarts/modelarts" "k8s.io/apimachinery/pkg/util/json" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" "github.com/zeromicro/go-zero/core/logx" ) type DeleteServiceLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } func NewDeleteServiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteServiceLogic { return &DeleteServiceLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, } } func (l *DeleteServiceLogic) DeleteService(req *types.DeleteServiceReq) (resp *types.DeleteServiceResp, err error) { modelartsReq := &modelarts.DeleteServiceReq{} err = copier.CopyWithOption(modelartsReq, req, copier.Option{Converters: utils.Converters}) deleteServiceResp, err := l.svcCtx.ModelArtsRpc.DeleteService(l.ctx, modelartsReq) if err != nil { return nil, error2.NewDefaultError(err.Error()) } marshal, err := json.Marshal(&deleteServiceResp) if err != nil { return nil, error2.NewDefaultError(err.Error()) } json.Unmarshal(marshal, &resp) err = copier.CopyWithOption(&resp, &deleteServiceResp, copier.Option{Converters: utils.Converters}) return resp, nil }