forked from JointCloud/pcm-coordinator
37 lines
1.1 KiB
Go
37 lines
1.1 KiB
Go
package participantservicelogic
|
|
|
|
import (
|
|
"context"
|
|
|
|
"gitlink.org.cn/jcce-pcm/pcm-coordinator/rpc/internal/svc"
|
|
"gitlink.org.cn/jcce-pcm/pcm-coordinator/rpc/pcmCore"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
|
|
type PauseListLogic struct {
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
logx.Logger
|
|
}
|
|
|
|
func NewPauseListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PauseListLogic {
|
|
return &PauseListLogic{
|
|
ctx: ctx,
|
|
svcCtx: svcCtx,
|
|
Logger: logx.WithContext(ctx),
|
|
}
|
|
}
|
|
|
|
// PauseList 暂停任务列表
|
|
func (l *PauseListLogic) PauseList(in *pcmCore.ApplyListReq) (*pcmCore.ApplyListResp, error) {
|
|
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)
|
|
if len(result.InfoList) != 0 {
|
|
l.svcCtx.DbEngin.Exec("update cloud set status = ? where status = ?", "Paused", "WaitPause")
|
|
}
|
|
return &result, nil
|
|
}
|