mirror of
https://github.com/OpenListTeam/OpenList.git
synced 2025-09-19 20:26:26 +08:00
add(trunk): base interface
This commit is contained in:
@ -35,3 +35,14 @@ type UserFileServer interface {
|
||||
// DelShare 删除分享 =======================================================================
|
||||
DelShare(ctx context.Context, path []string, opt *NewShareAction) ([]*BackFileAction, error)
|
||||
}
|
||||
|
||||
func ListFile(ctx context.Context, path []string, opt *ListFileOption) ([]*UserFileObject, error) {
|
||||
originList := make([]*HostFileObject, 0)
|
||||
serverList := make([]*UserFileObject, 0)
|
||||
for _, fileItem := range originList {
|
||||
serverList = append(serverList, &UserFileObject{
|
||||
HostFileObject: *fileItem,
|
||||
})
|
||||
}
|
||||
return serverList, nil
|
||||
}
|
||||
|
@ -2,24 +2,51 @@ package file
|
||||
|
||||
import "time"
|
||||
|
||||
type UserFileObject struct {
|
||||
showName []string // 文件名称
|
||||
showPath []string // 文件路径
|
||||
// HostFileObject 驱动层获取获取的文件信息
|
||||
type HostFileObject struct {
|
||||
realName []string // 真实名称
|
||||
realPath []string // 真实路径
|
||||
previews []string // 文件预览
|
||||
fileSize int64 // 文件大小
|
||||
fileTime time.Time // 修改时间
|
||||
lastTime time.Time // 修改时间
|
||||
makeTime time.Time // 创建时间
|
||||
fileType bool // 文件类型
|
||||
fileMask int16 // 文件权限
|
||||
checksum int32 // 密码校验
|
||||
encrypts int16 // 文件状态
|
||||
fileHash string // 文件哈希
|
||||
hashType int16 // 哈希类型
|
||||
}
|
||||
|
||||
// UserFileObject 由用户层转换后的文件信息
|
||||
type UserFileObject struct {
|
||||
HostFileObject
|
||||
showPath []string // 文件路径
|
||||
showName []string // 文件名称
|
||||
realPath []string // 真实路径
|
||||
checksum int32 // 密码校验
|
||||
fileMask int16 // 文件权限
|
||||
encrypts int16 // 文件状态
|
||||
|
||||
// 下列信息用于前端展示文件用
|
||||
enc_type string // 加解密类型
|
||||
enc_from string // 文件密码源
|
||||
enc_pass string // 加解密密码
|
||||
com_type string // 压缩的类型
|
||||
sub_nums int16 // 子文件数量
|
||||
|
||||
// 下列信息用于后端内部处理用
|
||||
// fileMask =================
|
||||
// 占用:000000 0 000 000 000
|
||||
// 含义:ABCDEF 1 421 421 421
|
||||
// A-is隐藏 B-is目录 C-is加密
|
||||
// D-is分卷 E-is压缩 F-is只读
|
||||
// encrypts =================
|
||||
// 占用位:0000000000 00 0000
|
||||
// 含义为:分卷数量 压缩 加密
|
||||
}
|
||||
|
||||
type PermissionFile struct {
|
||||
}
|
||||
|
||||
type LinkFileObject struct {
|
||||
download []string // 下载链接
|
||||
|
||||
}
|
||||
|
||||
type ListFileOption struct {
|
||||
@ -43,6 +70,3 @@ type NewShareAction struct {
|
||||
passkey string // 分析密码
|
||||
expired time.Time // 过期时间
|
||||
}
|
||||
type HostFileObject struct {
|
||||
UserFileObject
|
||||
}
|
||||
|
Reference in New Issue
Block a user