mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-12-08 02:20:24 +08:00
允许用户标记上传文件状态
This commit is contained in:
@@ -18,8 +18,6 @@ func (this *FileService) FindEnabledFile(ctx context.Context, req *pb.FindEnable
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// TODO 检查用户权限
|
||||
|
||||
var tx = this.NullTx()
|
||||
file, err := models.SharedFileDAO.FindEnabledFile(tx, req.FileId)
|
||||
if err != nil {
|
||||
@@ -67,13 +65,20 @@ func (this *FileService) CreateFile(ctx context.Context, req *pb.CreateFileReque
|
||||
|
||||
// UpdateFileFinished 将文件置为已完成
|
||||
func (this *FileService) UpdateFileFinished(ctx context.Context, req *pb.UpdateFileFinishedRequest) (*pb.RPCSuccess, error) {
|
||||
_, err := this.ValidateAdmin(ctx)
|
||||
_, userId, err := this.ValidateAdminAndUser(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var tx = this.NullTx()
|
||||
|
||||
if userId > 0 {
|
||||
err = models.SharedFileDAO.CheckUserFile(tx, userId, req.FileId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
err = models.SharedFileDAO.UpdateFileIsFinished(tx, req.FileId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user