mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-06 10:00:24 +08:00
IP制品列表中增加文件尺寸
This commit is contained in:
@@ -73,6 +73,20 @@ func (this *IPLibraryArtifactService) FindAllIPLibraryArtifacts(ctx context.Cont
|
|||||||
|
|
||||||
var pbArtifacts = []*pb.IPLibraryArtifact{}
|
var pbArtifacts = []*pb.IPLibraryArtifact{}
|
||||||
for _, artifact := range artifacts {
|
for _, artifact := range artifacts {
|
||||||
|
var pbFile *pb.File
|
||||||
|
if artifact.FileId > 0 {
|
||||||
|
fileInfo, err := models.SharedFileDAO.FindEnabledFile(tx, int64(artifact.FileId))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if fileInfo != nil {
|
||||||
|
pbFile = &pb.File{
|
||||||
|
Id: int64(fileInfo.Id),
|
||||||
|
Size: int64(fileInfo.Size),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pbArtifacts = append(pbArtifacts, &pb.IPLibraryArtifact{
|
pbArtifacts = append(pbArtifacts, &pb.IPLibraryArtifact{
|
||||||
Id: int64(artifact.Id),
|
Id: int64(artifact.Id),
|
||||||
Name: artifact.Name,
|
Name: artifact.Name,
|
||||||
@@ -81,6 +95,7 @@ func (this *IPLibraryArtifactService) FindAllIPLibraryArtifacts(ctx context.Cont
|
|||||||
MetaJSON: artifact.Meta,
|
MetaJSON: artifact.Meta,
|
||||||
IsPublic: artifact.IsPublic,
|
IsPublic: artifact.IsPublic,
|
||||||
Code: artifact.Code,
|
Code: artifact.Code,
|
||||||
|
File: pbFile,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return &pb.FindAllIPLibraryArtifactsResponse{
|
return &pb.FindAllIPLibraryArtifactsResponse{
|
||||||
|
|||||||
Reference in New Issue
Block a user