add(trunk): base interface

This commit is contained in:
pikachuim
2025-08-14 21:30:18 +08:00
parent 13aad2c2fa
commit 273e15a050
2 changed files with 47 additions and 12 deletions

View File

@ -35,3 +35,14 @@ type UserFileServer interface {
// DelShare 删除分享 ======================================================================= // DelShare 删除分享 =======================================================================
DelShare(ctx context.Context, path []string, opt *NewShareAction) ([]*BackFileAction, error) 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
}

View File

@ -2,24 +2,51 @@ package file
import "time" import "time"
type UserFileObject struct { // HostFileObject 驱动层获取获取的文件信息
showName []string // 文件名称 type HostFileObject struct {
showPath []string // 文件路径
realName []string // 真实名称 realName []string // 真实名称
realPath []string // 真实路径 previews []string // 文件预览
fileSize int64 // 文件大小 fileSize int64 // 文件大小
fileTime time.Time // 修改时间 lastTime time.Time // 修改时间
makeTime time.Time // 创建时间
fileType bool // 文件类型 fileType bool // 文件类型
fileMask int16 // 文件权限 fileHash string // 文件哈希
checksum int32 // 密码校验 hashType int16 // 哈希类型
encrypts 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 PermissionFile struct {
} }
type LinkFileObject struct { type LinkFileObject struct {
download []string // 下载链接 download []string // 下载链接
} }
type ListFileOption struct { type ListFileOption struct {
@ -43,6 +70,3 @@ type NewShareAction struct {
passkey string // 分析密码 passkey string // 分析密码
expired time.Time // 过期时间 expired time.Time // 过期时间
} }
type HostFileObject struct {
UserFileObject
}