This commit is contained in:
微凉
2021-10-31 00:36:17 +08:00
parent 47bea7cc38
commit a3f1553d40
6 changed files with 40 additions and 1 deletions

View File

@ -65,6 +65,7 @@ type AliFile struct {
FileId string `json:"file_id"`
Type string `json:"type"`
Name string `json:"name"`
Category string `json:"category"`
ParentFileId string `json:"parent_file_id"`
UpdatedAt *time.Time `json:"updated_at"`
Size int64 `json:"size"`
@ -78,12 +79,19 @@ func AliToFile(file AliFile) *model.File {
Size: file.Size,
UpdatedAt: file.UpdatedAt,
Thumbnail: file.Thumbnail,
Driver: "AliDrive",
}
if file.Type == "folder" {
f.Type = conf.FOLDER
} else {
f.Type = utils.GetFileType(file.FileExtension)
}
if file.Category == "video" {
f.Type = conf.VIDEO
}
if file.Category == "image" {
f.Type = conf.IMAGE
}
return f
}

View File

@ -62,6 +62,7 @@ func (n Native) Path(path string, account *model.Account) (*model.File, []*model
Size: f.Size(),
Type: 0,
UpdatedAt: &time,
Driver: "Native",
}
if f.IsDir() {
file.Type = conf.FOLDER
@ -82,6 +83,7 @@ func (n Native) Path(path string, account *model.Account) (*model.File, []*model
Size: f.Size(),
Type: utils.GetFileType(filepath.Ext(f.Name())),
UpdatedAt: &time,
Driver: "Native",
}
return file, nil, nil
}