diff --git a/internal/logic/adapters/createclusterlogic.go b/internal/logic/adapters/createclusterlogic.go index 4e14fc473..2832f9337 100644 --- a/internal/logic/adapters/createclusterlogic.go +++ b/internal/logic/adapters/createclusterlogic.go @@ -13,6 +13,7 @@ import ( "k8s.io/apimachinery/pkg/util/json" "net/http" "net/url" + "strconv" "time" "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") } // 创建资源价格信息 + clusterId, _ := strconv.ParseInt(cluster.Id, 10, 64) resourcePrice := &types.ResourcePrice{ + ResourceID: clusterId, Price: req.Price, ResourceType: constants.CLUSTER, CostType: req.CostType, diff --git a/internal/logic/cloud/commitgeneraltasklogic.go b/internal/logic/cloud/commitgeneraltasklogic.go index 8b4f0453f..345664a81 100644 --- a/internal/logic/cloud/commitgeneraltasklogic.go +++ b/internal/logic/cloud/commitgeneraltasklogic.go @@ -99,6 +99,7 @@ func (l *CommitGeneralTaskLogic) CommitGeneralTask(req *types.GeneralTaskReq) er AdapterTypeDict: "0", SynergyStatus: synergyStatus, Strategy: strategy, + UserId: req.UserId, } var taskClouds []cloud.TaskCloudModel adapterName := "" diff --git a/internal/logic/hpc/commithpctasklogic.go b/internal/logic/hpc/commithpctasklogic.go index e22e150d1..62d040014 100644 --- a/internal/logic/hpc/commithpctasklogic.go +++ b/internal/logic/hpc/commithpctasklogic.go @@ -48,6 +48,7 @@ func (l *CommitHpcTaskLogic) CommitHpcTask(req *types.CommitHpcTaskReq) (resp *t CommitTime: time.Now(), Status: "Running", AdapterTypeDict: "2", + UserId: req.UserId, } // 保存任务数据到数据库 diff --git a/pkg/models/taskmodel_gen.go b/pkg/models/taskmodel_gen.go index e57c0f5db..f099c4dcd 100644 --- a/pkg/models/taskmodel_gen.go +++ b/pkg/models/taskmodel_gen.go @@ -51,6 +51,7 @@ type ( NsID string `db:"ns_id" json:"nsID"` AdapterTypeDict string `db:"adapter_type_dict" json:"adapterTypeDict"` //任务类型(对应字典表的值) TaskTypeDict string `db:"task_type_dict" json:"taskTypeDict"` + UserId int64 `db:"user_id" json:"userId"` } )