|
|
|
|
@ -1,5 +1,10 @@
|
|
|
|
|
package model
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"strings"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type VendorMeResp[T any] struct {
|
|
|
|
|
IsLogin bool `json:"isLogin"`
|
|
|
|
|
Info T `json:"info,omitempty"`
|
|
|
|
|
@ -11,13 +16,32 @@ type VendorFSListResp struct {
|
|
|
|
|
Total uint64 `json:"total"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Item struct {
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
Path string `json:"path"`
|
|
|
|
|
IsDir bool `json:"isDir"`
|
|
|
|
|
func GenDefaultPaths(path string) []*Path {
|
|
|
|
|
paths := []*Path{}
|
|
|
|
|
path = strings.TrimRight(path, "/")
|
|
|
|
|
for i, v := range strings.Split(path, `/`) {
|
|
|
|
|
if i != 0 {
|
|
|
|
|
paths = append(paths, &Path{
|
|
|
|
|
Name: v,
|
|
|
|
|
Path: fmt.Sprintf("%s/%s", paths[i-1].Path, v),
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
paths = append(paths, &Path{
|
|
|
|
|
Name: v,
|
|
|
|
|
Path: v,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return paths
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Path struct {
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
Path string `json:"path"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Item struct {
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
Path string `json:"path"`
|
|
|
|
|
IsDir bool `json:"isDir"`
|
|
|
|
|
}
|
|
|
|
|
|