创建任务添加user_id

This commit is contained in:
zhangwei 2025-03-07 16:10:56 +08:00
parent dd2141de25
commit cdff8aeb0c
4 changed files with 6 additions and 0 deletions

View File

@ -13,6 +13,7 @@ import (
"k8s.io/apimachinery/pkg/util/json" "k8s.io/apimachinery/pkg/util/json"
"net/http" "net/http"
"net/url" "net/url"
"strconv"
"time" "time"
"github.com/zeromicro/go-zero/core/logx" "github.com/zeromicro/go-zero/core/logx"
@ -65,7 +66,9 @@ func (l *CreateClusterLogic) CreateCluster(req *types.ClusterCreateReq) (resp *t
return nil, errors.New("cluster create failed") return nil, errors.New("cluster create failed")
} }
// 创建资源价格信息 // 创建资源价格信息
clusterId, _ := strconv.ParseInt(cluster.Id, 10, 64)
resourcePrice := &types.ResourcePrice{ resourcePrice := &types.ResourcePrice{
ResourceID: clusterId,
Price: req.Price, Price: req.Price,
ResourceType: constants.CLUSTER, ResourceType: constants.CLUSTER,
CostType: req.CostType, CostType: req.CostType,

View File

@ -99,6 +99,7 @@ func (l *CommitGeneralTaskLogic) CommitGeneralTask(req *types.GeneralTaskReq) er
AdapterTypeDict: "0", AdapterTypeDict: "0",
SynergyStatus: synergyStatus, SynergyStatus: synergyStatus,
Strategy: strategy, Strategy: strategy,
UserId: req.UserId,
} }
var taskClouds []cloud.TaskCloudModel var taskClouds []cloud.TaskCloudModel
adapterName := "" adapterName := ""

View File

@ -48,6 +48,7 @@ func (l *CommitHpcTaskLogic) CommitHpcTask(req *types.CommitHpcTaskReq) (resp *t
CommitTime: time.Now(), CommitTime: time.Now(),
Status: "Running", Status: "Running",
AdapterTypeDict: "2", AdapterTypeDict: "2",
UserId: req.UserId,
} }
// 保存任务数据到数据库 // 保存任务数据到数据库

View File

@ -51,6 +51,7 @@ type (
NsID string `db:"ns_id" json:"nsID"` NsID string `db:"ns_id" json:"nsID"`
AdapterTypeDict string `db:"adapter_type_dict" json:"adapterTypeDict"` //任务类型(对应字典表的值) AdapterTypeDict string `db:"adapter_type_dict" json:"adapterTypeDict"` //任务类型(对应字典表的值)
TaskTypeDict string `db:"task_type_dict" json:"taskTypeDict"` TaskTypeDict string `db:"task_type_dict" json:"taskTypeDict"`
UserId int64 `db:"user_id" json:"userId"`
} }
) )