From d77b8eba2778e6c267b830af47e06a4310e4add6 Mon Sep 17 00:00:00 2001 From: devad Date: Wed, 3 Jan 2024 16:40:25 +0800 Subject: [PATCH] fix bugs Signed-off-by: devad Former-commit-id: 4eee4c12a977fa005d45054ed1c6e75863b1f6b6 --- rpc/client/participantservice/participantservice.go | 4 ++-- rpc/internal/logic/participantservice/pauselistlogic.go | 2 +- rpc/internal/logic/participantservice/restartlistlogic.go | 2 +- rpc/internal/logic/participantservice/startlistlogic.go | 4 ++-- .../server/participantservice/participantserviceserver.go | 2 +- rpc/pcmCore/pcmCore_grpc.pb.go | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/rpc/client/participantservice/participantservice.go b/rpc/client/participantservice/participantservice.go index 172a7ba3..f3d93261 100644 --- a/rpc/client/participantservice/participantservice.go +++ b/rpc/client/participantservice/participantservice.go @@ -68,7 +68,7 @@ type ( RestartList(ctx context.Context, in *ApplyListReq, opts ...grpc.CallOption) (*ApplyListResp, error) // PauseList 暂停任务列表 PauseList(ctx context.Context, in *ApplyListReq, opts ...grpc.CallOption) (*ApplyListResp, error) - // StartList 暂停任务列表 + // StartList 启动任务列表 StartList(ctx context.Context, in *ApplyListReq, opts ...grpc.CallOption) (*ApplyListResp, error) } @@ -155,7 +155,7 @@ func (m *defaultParticipantService) PauseList(ctx context.Context, in *ApplyList return client.PauseList(ctx, in, opts...) } -// StartList 暂停任务列表 +// StartList 启动任务列表 func (m *defaultParticipantService) StartList(ctx context.Context, in *ApplyListReq, opts ...grpc.CallOption) (*ApplyListResp, error) { client := pcmCore.NewParticipantServiceClient(m.cli.Conn()) return client.StartList(ctx, in, opts...) diff --git a/rpc/internal/logic/participantservice/pauselistlogic.go b/rpc/internal/logic/participantservice/pauselistlogic.go index f459fd03..339786a3 100644 --- a/rpc/internal/logic/participantservice/pauselistlogic.go +++ b/rpc/internal/logic/participantservice/pauselistlogic.go @@ -28,7 +28,7 @@ func (l *PauseListLogic) PauseList(in *pcmCore.ApplyListReq) (*pcmCore.ApplyList result := pcmCore.ApplyListResp{ InfoList: make([]*pcmCore.ApplyInfo, 0), } - l.svcCtx.DbEngin.Raw("SELECT sppi.`name` as ParticipantName, c.ns_id as namespace,c.name as name , c.kind as kind FROM cloud c,sc_participant_phy_info sppi where c.`status` = 'WaitPause' and sppi.id = c.participant_id").Scan(&result.InfoList) + l.svcCtx.DbEngin.Raw("SELECT sppi.`name` as ParticipantName, c.ns_id as namespace,c.name as name , c.kind as kind FROM cloud c,sc_participant_phy_info sppi where c.`status` = 'WaitPause' and sppi.id = c.participant_id and deleted_at is null").Scan(&result.InfoList) if len(result.InfoList) != 0 { l.svcCtx.DbEngin.Exec("update cloud set status = ? where status = ?", "Paused", "WaitPause") } diff --git a/rpc/internal/logic/participantservice/restartlistlogic.go b/rpc/internal/logic/participantservice/restartlistlogic.go index 15b907ca..43057298 100644 --- a/rpc/internal/logic/participantservice/restartlistlogic.go +++ b/rpc/internal/logic/participantservice/restartlistlogic.go @@ -28,7 +28,7 @@ func (l *RestartListLogic) RestartList(in *pcmCore.ApplyListReq) (*pcmCore.Apply result := pcmCore.ApplyListResp{ InfoList: make([]*pcmCore.ApplyInfo, 0), } - l.svcCtx.DbEngin.Raw("SELECT sppi.`name` as ParticipantName, c.ns_id as namespace,c.name as name , c.kind as kind FROM cloud c,sc_participant_phy_info sppi where c.`status` = 'WaitRestart' and sppi.id = c.participant_id").Scan(&result.InfoList) + l.svcCtx.DbEngin.Raw("SELECT sppi.`name` as ParticipantName, c.ns_id as namespace,c.name as name , c.kind as kind FROM cloud c,sc_participant_phy_info sppi where c.`status` = 'WaitRestart' and sppi.id = c.participant_id and deleted_at is null").Scan(&result.InfoList) if len(result.InfoList) != 0 { l.svcCtx.DbEngin.Exec("update cloud set status = ? where status = ?", "Issued", "WaitRestart") } diff --git a/rpc/internal/logic/participantservice/startlistlogic.go b/rpc/internal/logic/participantservice/startlistlogic.go index 20429cad..3077ba83 100644 --- a/rpc/internal/logic/participantservice/startlistlogic.go +++ b/rpc/internal/logic/participantservice/startlistlogic.go @@ -28,9 +28,9 @@ func (l *StartListLogic) StartList(in *pcmCore.ApplyListReq) (*pcmCore.ApplyList result := pcmCore.ApplyListResp{ InfoList: make([]*pcmCore.ApplyInfo, 0), } - l.svcCtx.DbEngin.Raw("SELECT sppi.`name` as ParticipantName, c.ns_id as namespace,c.name as name , c.kind as kind FROM cloud c,sc_participant_phy_info sppi where c.`status` = 'Paused' and sppi.id = c.participant_id").Scan(&result.InfoList) + l.svcCtx.DbEngin.Raw("SELECT sppi.`name` as ParticipantName, c.ns_id as namespace,c.name as name , c.kind as kind FROM cloud c,sc_participant_phy_info sppi where c.`status` = 'WaitStart' and sppi.id = c.participant_id and deleted_at is null").Scan(&result.InfoList) if len(result.InfoList) != 0 { - l.svcCtx.DbEngin.Exec("update cloud set status = ? where status = ?", "Issued", "Paused") + l.svcCtx.DbEngin.Exec("update cloud set status = ? where status = ?", "Issued", "WaitStart") } return &result, nil } diff --git a/rpc/internal/server/participantservice/participantserviceserver.go b/rpc/internal/server/participantservice/participantserviceserver.go index 08f99cf6..6a1f09eb 100644 --- a/rpc/internal/server/participantservice/participantserviceserver.go +++ b/rpc/internal/server/participantservice/participantserviceserver.go @@ -94,7 +94,7 @@ func (s *ParticipantServiceServer) PauseList(ctx context.Context, in *pcmCore.Ap return l.PauseList(in) } -// StartList 暂停任务列表 +// StartList 启动任务列表 func (s *ParticipantServiceServer) StartList(ctx context.Context, in *pcmCore.ApplyListReq) (*pcmCore.ApplyListResp, error) { l := participantservicelogic.NewStartListLogic(ctx, s.svcCtx) return l.StartList(in) diff --git a/rpc/pcmCore/pcmCore_grpc.pb.go b/rpc/pcmCore/pcmCore_grpc.pb.go index 63a41a55..b13570c7 100644 --- a/rpc/pcmCore/pcmCore_grpc.pb.go +++ b/rpc/pcmCore/pcmCore_grpc.pb.go @@ -193,7 +193,7 @@ type ParticipantServiceClient interface { RestartList(ctx context.Context, in *ApplyListReq, opts ...grpc.CallOption) (*ApplyListResp, error) // PauseList 暂停任务列表 PauseList(ctx context.Context, in *ApplyListReq, opts ...grpc.CallOption) (*ApplyListResp, error) - // StartList 暂停任务列表 + // StartList 启动任务列表 StartList(ctx context.Context, in *ApplyListReq, opts ...grpc.CallOption) (*ApplyListResp, error) } @@ -350,7 +350,7 @@ type ParticipantServiceServer interface { RestartList(context.Context, *ApplyListReq) (*ApplyListResp, error) // PauseList 暂停任务列表 PauseList(context.Context, *ApplyListReq) (*ApplyListResp, error) - // StartList 暂停任务列表 + // StartList 启动任务列表 StartList(context.Context, *ApplyListReq) (*ApplyListResp, error) mustEmbedUnimplementedParticipantServiceServer() }