Documentation
¶
Index ¶
- type Service
- func (s *Service) CheckFileExists(code string) bool
- func (s *Service) CreateFileShare(code, prefix, suffix, uuidFileName, filePath, text string, fileSize int64, ...) (*models.FileCode, error)
- func (s *Service) DeleteFileShare(code string) error
- func (s *Service) DownloadFile(c *gin.Context, code string) error
- func (s *Service) GetFileByCode(code string) (*models.FileCode, error)
- func (s *Service) GetFileByCodeWithAuth(code string, userID *uint) (*models.FileCode, error)
- func (s *Service) GetFileInfo(code string) (*models.FileCode, error)
- func (s *Service) GetShareStats(code string) (*service.ShareStatsData, error)
- func (s *Service) GetStorageService() interface{}
- func (s *Service) ListUserFiles(userID uint, page, pageSize int) ([]models.FileCode, int64, error)
- func (s *Service) SetUserService(userService UserServiceInterface)
- func (s *Service) ShareFileWithAuth(req models.ShareFileRequest) (*models.ShareFileResult, error)
- func (s *Service) ShareText(text string, expireValue int, expireStyle string) (*models.ShareTextResult, error)
- func (s *Service) ShareTextWithAuth(text string, expireValue int, expireStyle string, userID *uint) (*models.ShareTextResult, error)
- func (s *Service) UpdateFileShare(code string, updates map[string]interface{}) error
- func (s *Service) UpdateFileUsage(code string) error
- type UserServiceInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service 分享服务
func NewService ¶
func NewService(repositoryManager *repository.RepositoryManager, manager *config.ConfigManager, storageService *storage.ConcreteStorageService) *Service
NewService 创建分享服务
func (*Service) CheckFileExists ¶
CheckFileExists 检查文件是否存在
func (*Service) CreateFileShare ¶
func (s *Service) CreateFileShare( code, prefix, suffix, uuidFileName, filePath, text string, fileSize int64, expiredAt *time.Time, expiredCount int, userID *uint, requireAuth bool, ownerIP string, ) (*models.FileCode, error)
CreateFileShare 创建文件分享
func (*Service) DeleteFileShare ¶
DeleteFileShare 删除文件分享
func (*Service) DownloadFile ¶
DownloadFile 下载文件
func (*Service) GetFileByCode ¶
GetFileByCode 通过代码获取文件
func (*Service) GetFileByCodeWithAuth ¶
GetFileByCodeWithAuth 带认证获取文件 (兼容性方法)
func (*Service) GetFileInfo ¶
GetFileInfo 获取文件信息(不下载)
func (*Service) GetShareStats ¶
func (s *Service) GetShareStats(code string) (*service.ShareStatsData, error)
GetShareStats 获取分享统计信息
func (*Service) GetStorageService ¶
func (s *Service) GetStorageService() interface{}
GetStorageService 获取存储服务 (兼容性方法)
func (*Service) ListUserFiles ¶
ListUserFiles 列出用户的文件
func (*Service) SetUserService ¶
func (s *Service) SetUserService(userService UserServiceInterface)
SetUserService 设置用户服务(用于避免循环依赖)
func (*Service) ShareFileWithAuth ¶
func (s *Service) ShareFileWithAuth(req models.ShareFileRequest) (*models.ShareFileResult, error)
ShareFileWithAuth 带认证的文件分享
func (*Service) ShareText ¶
func (s *Service) ShareText(text string, expireValue int, expireStyle string) (*models.ShareTextResult, error)
ShareText 分享文本内容
func (*Service) ShareTextWithAuth ¶
func (s *Service) ShareTextWithAuth(text string, expireValue int, expireStyle string, userID *uint) (*models.ShareTextResult, error)
ShareTextWithAuth 带认证的文本分享 (兼容性方法)
func (*Service) UpdateFileShare ¶
UpdateFileShare 更新文件分享信息
func (*Service) UpdateFileUsage ¶
UpdateFileUsage 更新文件使用情况 (兼容性方法)
Click to show internal directories.
Click to hide internal directories.