pcm-ac/internal/logic/selectqueuebyuserlogic.go

35 lines
933 B
Go

package logic
import (
"context"
"fmt"
"github.com/zeromicro/go-zero/core/logx"
"gitlink.org.cn/JointCloud/pcm-ac/hpcAC"
"gitlink.org.cn/JointCloud/pcm-ac/internal/pkg/utils"
"gitlink.org.cn/JointCloud/pcm-ac/internal/svc"
)
type SelectQueueByUserLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewSelectQueueByUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SelectQueueByUserLogic {
return &SelectQueueByUserLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
// SelectQueueByUser 查询用户可访问队列列表
func (l *SelectQueueByUserLogic) SelectQueueByUser(in *hpcAC.QueueReq) (*hpcAC.QueueResp, error) {
resp := hpcAC.QueueResp{}
url := fmt.Sprintf("/hpc/openapi/v2/queuenames/users/%s/?strJobManagerID=%s", in.User, in.StrJobManagerID)
_, _ = utils.Get("", l.svcCtx.Config.ClusterUrl, url, nil, nil, &resp)
return &resp, nil
}