From a4bf41dae1231634b6ea1dc665faaf46e78c6178 Mon Sep 17 00:00:00 2001 From: zhangwei <894646498@qq.com> Date: Thu, 28 Aug 2025 18:19:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=B9=E5=99=A8=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/logic/cloud/containerdeletelogic.go | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/internal/logic/cloud/containerdeletelogic.go b/internal/logic/cloud/containerdeletelogic.go index 53005470..98de9609 100644 --- a/internal/logic/cloud/containerdeletelogic.go +++ b/internal/logic/cloud/containerdeletelogic.go @@ -17,13 +17,11 @@ package cloud import ( "context" "errors" - "fmt" "github.com/zeromicro/go-zero/core/logx" "gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc" container "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types/cloud" "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models" "net/http" - "strconv" ) type ContainerDeleteLogic struct { @@ -41,7 +39,11 @@ func NewContainerDeleteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *C } func (l *ContainerDeleteLogic) ContainerDelete(req *container.DeleteParam) (resp interface{}, err error) { - + taskCloud := models.TaskCloud{} + l.svcCtx.DbEngin.Model(models.TaskAi{}).Where("id", req.Id).Scan(&taskCloud) + if taskCloud.Name == "" { + return nil, errors.New("任务不存在") + } create, err := l.svcCtx.Cloud.ContainerDelete(req.ClusterId, req) if err != nil { return nil, err @@ -49,12 +51,7 @@ func (l *ContainerDeleteLogic) ContainerDelete(req *container.DeleteParam) (resp if create.Code != http.StatusOK { return nil, errors.New(create.Message) } - resp = create.Data - id, err := strconv.ParseInt(req.Id, 10, 64) - tx := l.svcCtx.DbEngin.Delete(&models.TaskCloud{}, id) - if tx.Error != nil { - fmt.Println() - return nil, tx.Error - } + taskCloud.Status = "Deleted" + l.svcCtx.DbEngin.Updates(taskCloud) return }