From 4587a69b043524a356953562a02b7665fc4e1ec5 Mon Sep 17 00:00:00 2001 From: zhangwei <894646498@qq.com> Date: Mon, 11 Nov 2024 15:20:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=B6=85=E7=AE=97=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9clusterId=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- desc/core/pcm-core.api | 2 +- desc/hpc/pcm-hpc.api | 2 +- internal/logic/cloud/getclusterlistlogic.go | 2 +- internal/logic/hpc/commithpctasklogic.go | 6 +++--- internal/types/types.go | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/desc/core/pcm-core.api b/desc/core/pcm-core.api index e9fc40f16..8b3064f2f 100644 --- a/desc/core/pcm-core.api +++ b/desc/core/pcm-core.api @@ -133,7 +133,7 @@ type ( type ( getClusterListReq { - Id int64 `form:"id"` + AdapterId int64 `form:"adapterId"` } getClusterListResp { Clusters []ClusterInfo `json:"clusters"` diff --git a/desc/hpc/pcm-hpc.api b/desc/hpc/pcm-hpc.api index a1d67390d..3022215ef 100644 --- a/desc/hpc/pcm-hpc.api +++ b/desc/hpc/pcm-hpc.api @@ -10,7 +10,7 @@ info( type ( commitHpcTaskReq { - ClusterId int64 `json:"clusterId,optional"` + ClusterId string `json:"clusterId,optional"` Name string `json:"name"` Account string `json:"account,optional"` Description string `json:"description,optional"` diff --git a/internal/logic/cloud/getclusterlistlogic.go b/internal/logic/cloud/getclusterlistlogic.go index 2743f0f71..e1a5c2da1 100644 --- a/internal/logic/cloud/getclusterlistlogic.go +++ b/internal/logic/cloud/getclusterlistlogic.go @@ -25,6 +25,6 @@ func NewGetClusterListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Ge func (l *GetClusterListLogic) GetClusterList(req *types.GetClusterListReq) (resp *types.GetClusterListResp, err error) { resp = &types.GetClusterListResp{} //clusters := []models.ScParticipantPhyInfo{} - l.svcCtx.DbEngin.Find(resp.Clusters).Where("id", req.Id) + l.svcCtx.DbEngin.Raw("select * from t_cluster where adapter_id = ?", req.AdapterId).Scan(&resp.Clusters) return resp, nil } diff --git a/internal/logic/hpc/commithpctasklogic.go b/internal/logic/hpc/commithpctasklogic.go index 9b5e24045..37fde84c3 100644 --- a/internal/logic/hpc/commithpctasklogic.go +++ b/internal/logic/hpc/commithpctasklogic.go @@ -58,12 +58,12 @@ func (l *CommitHpcTaskLogic) CommitHpcTask(req *types.CommitHpcTaskReq) (resp *t if len(adapterName) == 0 || adapterName == "" { return nil, errors.New("no corresponding adapter found") } - + clusterId, err := strconv.ParseInt(req.ClusterId, 10, 64) hpcInfo := models.TaskHpc{ TaskId: taskModel.Id, AdapterId: clusterInfo.AdapterId, AdapterName: adapterName, - ClusterId: req.ClusterId, + ClusterId: clusterId, ClusterName: clusterInfo.Name, Name: taskModel.Name, CmdScript: req.CmdScript, @@ -97,7 +97,7 @@ func (l *CommitHpcTaskLogic) CommitHpcTask(req *types.CommitHpcTaskReq) (resp *t noticeInfo := clientCore.NoticeInfo{ AdapterId: clusterInfo.AdapterId, AdapterName: adapterName, - ClusterId: req.ClusterId, + ClusterId: clusterId, ClusterName: clusterInfo.Name, NoticeType: "create", TaskName: req.Name, diff --git a/internal/types/types.go b/internal/types/types.go index 608482b17..0d21eff35 100644 --- a/internal/types/types.go +++ b/internal/types/types.go @@ -119,7 +119,7 @@ type ClusterLoadRecord struct { } type GetClusterListReq struct { - Id int64 `form:"id"` + AdapterId int64 `form:"adapterId"` } type GetClusterListResp struct { @@ -1276,7 +1276,7 @@ type CommonResp struct { } type CommitHpcTaskReq struct { - ClusterId int64 `json:"clusterId,optional"` + ClusterId string `json:"clusterId,optional"` Name string `json:"name"` Account string `json:"account,optional"` Description string `json:"description,optional"`