diff --git a/adaptor/PCM-CORE/api/internal/logic/image/imagelistlogic.go b/adaptor/PCM-CORE/api/internal/logic/image/imagelistlogic.go index 3081d2ba..859b4548 100644 --- a/adaptor/PCM-CORE/api/internal/logic/image/imagelistlogic.go +++ b/adaptor/PCM-CORE/api/internal/logic/image/imagelistlogic.go @@ -27,31 +27,12 @@ func NewImageListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ImageLi } func (l *ImageListLogic) ImageList() (resp *types.ImageListResp, err error) { + var images []string + l.svcCtx.DbEngin.Raw("select distinct name from file where kind = 'image'").Scan(&images) - // 获取镜像列表 - //url := fmt.Sprintf("%s/repository/%s/v2/_catalog", l.svcCtx.Config.NexusUrl, "pcm") - //bytes, err := tool.HttpClient("GET", url, nil, "") - //json.Unmarshal(bytes, &resp) - //result := types.ImageListResp{} - //for _, image := range resp.Repositories { - // // 获取镜像的tag列表 - // url := fmt.Sprintf("registry.cn-hangzhou.aliyuncs.com/jointcloud/pcm:", image) - // bytes, err := tool.HttpClient("GET", url, nil, "") - // if err != nil { - // return nil, err - // } - // tags := ImageTags{} - // json.Unmarshal(bytes, &tags) - // // 拼接镜像名称 - // for _, tag := range tags.Tags { - // var name string - // if tag != "latest" { - // name = "hub.jcce.dev:18445/" + image + ":" + tag - // } else { - // name = "hub.jcce.dev:18445/" + image - // } - // result.Repositories = append(result.Repositories, name) - // } - //} - return nil, nil + result := types.ImageListResp{ + Repositories: images, + } + + return &result, nil }