Skip to content

Commit

Permalink
Merge branch 'main' into fix/重构文件服务
Browse files Browse the repository at this point in the history
  • Loading branch information
Love-YeLin authored Apr 11, 2024
2 parents 3c67784 + a1e7603 commit 21facc5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion biz/application/service/publicfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ func (s *PublicFileService) GetPublicFile(ctx context.Context, req *gencontent.G
return resp, err
}
}

return resp, nil
}

Expand Down Expand Up @@ -179,6 +178,7 @@ func (s *PublicFileService) GetPublicFileList(ctx context.Context, req *genconte
return resp, err
}


return resp, nil
}

Expand Down Expand Up @@ -214,11 +214,13 @@ func (s *PublicFileService) AddFileToPublicSpace(ctx context.Context, req *genco
if res, err = s.FileMongoMapper.FindOne(ctx, req.Id); err != nil {
return resp, err
}

tx := s.PublicFileMongoMapper.StartClient()
err = tx.UseSession(ctx, func(sessionContext mongo.SessionContext) error {
if err = sessionContext.StartTransaction(); err != nil {
return err
}

if rootId, err = s.PublicFileMongoMapper.Insert(ctx, &publicfilemapper.PublicFile{ // 创建根文件
ID: primitive.NilObjectID,
UserId: res.UserId,
Expand All @@ -240,6 +242,7 @@ func (s *PublicFileService) AddFileToPublicSpace(ctx context.Context, req *genco

queue := make([]kv, 0, s.Config.InitialSliceLength)
queue = append(queue, kv{req.Id, req.Zone + "/" + rootId})

if res.Size == int64(gencontent.Folder_Folder_Size) {
for len(queue) > 0 {
front = queue[0]
Expand Down

0 comments on commit 21facc5

Please sign in to comment.