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 StartListLogic struct {
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
logx.Logger
|
|
}
|
|
|
|
func NewStartListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *StartListLogic {
|
|
return &StartListLogic{
|
|
ctx: ctx,
|
|
svcCtx: svcCtx,
|
|
Logger: logx.WithContext(ctx),
|
|
}
|
|
}
|
|
|
|
// StartList 启动任务列表
|
|
func (l *StartListLogic) StartList(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` = 'Paused' and sppi.id = c.participant_id").Scan(&result.InfoList)
|
|
if len(result.InfoList) != 0 {
|
|
l.svcCtx.DbEngin.Exec("update cloud set status = ? where status = ?", "Issued", "Paused")
|
|
}
|
|
return &result, nil
|
|
}
|