Signed-off-by: devad <cossjie@foxmail.com>
This commit is contained in:
devad 2024-01-03 16:40:25 +08:00
parent d409682046
commit 4eee4c12a9
6 changed files with 9 additions and 9 deletions

View File

@ -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...)

View File

@ -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")
}

View File

@ -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")
}

View File

@ -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
}

View File

@ -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)

View File

@ -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()
}