1Panel/backend/app/service/file.go

28 lines
535 B
Go
Raw Normal View History

2022-08-24 11:10:50 +08:00
package service
import (
"github.com/1Panel-dev/1Panel/app/dto"
"github.com/1Panel-dev/1Panel/utils/files"
)
type FileService struct {
}
type IFileService interface {
GetFileList(op dto.FileOption) (dto.FileInfo, error)
}
func NewFileService() IFileService {
return FileService{}
}
func (f FileService) GetFileList(op dto.FileOption) (dto.FileInfo, error) {
var fileInfo dto.FileInfo
info, err := files.NewFileInfo(op.FileOption)
if err != nil {
return fileInfo, err
}
fileInfo.FileInfo = *info
return fileInfo, nil
}