删除任务接口修改

This commit is contained in:
zhangwei 2023-11-01 17:22:25 +08:00
parent e35c9a5e05
commit afd3152161
3 changed files with 12 additions and 8 deletions

View File

@ -184,6 +184,7 @@ type (
TaskYaml {
TaskId int64 `yaml:"taskId"`
taskType string `yaml:"taskType"`
participantId int64 `yaml:"participantId"`
matchLabels map[string]string `yaml:"matchLabels"`
metadata interface{} `yaml:"metadata"`
}

View File

@ -2,7 +2,7 @@ package core
import (
"context"
models2 "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/models"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/models"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
@ -26,12 +26,14 @@ func NewDeleteTaskLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Delete
func (l *DeleteTaskLogic) DeleteTask(req *types.DeleteTaskReq) error {
// 删除主任务信息
tx := l.svcCtx.DbEngin.Delete(&models2.Task{}, req.Id)
l.svcCtx.DbEngin.Model(&models.Task{}).Where("id", req.Id).Update("status", "Deleted")
tx := l.svcCtx.DbEngin.Delete(&models.Task{}, req.Id)
if tx.Error != nil {
return tx.Error
}
// 将子任务信息修改为待删除
tx = l.svcCtx.DbEngin.Model(&models2.Cloud{}).Where("task_id", req.Id).Update("status", "WaitDelete")
// 将子任务状态修改为待删除
tx = l.svcCtx.DbEngin.Model(&models.Cloud{}).Where("task_id", req.Id).Update("status", "WaitDelete")
l.svcCtx.DbEngin.Where("task_id = ?", req.Id).Delete(&models.Cloud{}, req.Id)
if tx.Error != nil {
return tx.Error
}

View File

@ -164,10 +164,11 @@ type ScheduleTaskByYamlReq struct {
}
type TaskYaml struct {
TaskId int64 `yaml:"taskId"`
TaskType string `yaml:"taskType"`
MatchLabels map[string]string `yaml:"matchLabels"`
Metadata interface{} `yaml:"metadata"`
TaskId int64 `yaml:"taskId"`
TaskType string `yaml:"taskType"`
ParticipantId int64 `yaml:"participantId"`
MatchLabels map[string]string `yaml:"matchLabels"`
Metadata interface{} `yaml:"metadata"`
}
type ScheduleTaskByYamlResp struct {