mirror of
https://github.com/cloudreve/Cloudreve.git
synced 2026-11-17 22:58:07 +00:00
Test: middleware / file / folder
This commit is contained in:
1 parent
c15b8a047d
commit
362a7c389d
6 files changed
+243
-11
No files matched your search
+7
-7
@@ -127,13 +127,13 @@ func DeleteFileByIDs(ids []uint) error {
|
||||
return result.Error
|
||||
}
|
||||
|
||||
// GetRecursiveByPaths 根据给定的文件路径(s)递归查找文件
|
||||
func GetRecursiveByPaths(paths []string, uid uint) ([]File, error) {
|
||||
files := make([]File, 0, len(paths))
|
||||
search := util.BuildRegexp(paths, "^", "/", "|")
|
||||
result := DB.Where("(user_id = ? and dir REGEXP ?) or (user_id = ? and dir in (?))", uid, search, uid, paths).Find(&files)
|
||||
return files, result.Error
|
||||
}
|
||||
//// GetRecursiveByPaths 根据给定的文件路径(s)递归查找文件
|
||||
//func GetRecursiveByPaths(paths []string, uid uint) ([]File, error) {
|
||||
// files := make([]File, 0, len(paths))
|
||||
// search := util.BuildRegexp(paths, "^", "/", "|")
|
||||
// result := DB.Where("(user_id = ? and dir REGEXP ?) or (user_id = ? and dir in (?))", uid, search, uid, paths).Find(&files)
|
||||
// return files, result.Error
|
||||
//}
|
||||
|
||||
// GetFilesByParentIDs 根据父目录ID查找文件
|
||||
func GetFilesByParentIDs(ids []uint, uid uint) ([]File, error) {
|
||||
|
||||
Reference in new issue
Block a user