user

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

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) *Service

NewService 创建用户服务

func (*Service) ChangePassword

func (s *Service) ChangePassword(userID uint, oldPassword, newPassword string) error

ChangePassword 修改密码

func (*Service) CheckPasswordHash

func (s *Service) CheckPasswordHash(password, hash string) bool

CheckPasswordHash 验证密码哈希

func (*Service) CheckUserQuota

func (s *Service) CheckUserQuota(userID uint, fileSize int64) error

CheckUserQuota 检查用户配额

func (*Service) DeleteAccount

func (s *Service) DeleteAccount(userID uint) error

DeleteAccount 删除用户账户

func (*Service) DeleteUserFileByCode

func (s *Service) DeleteUserFileByCode(userID uint, code string) error

DeleteUserFileByCode 根据代码删除用户文件 (兼容性方法)

func (*Service) GetAdminUserCount

func (s *Service) GetAdminUserCount() (int64, error)

GetAdminUserCount 获取管理员用户数量

func (*Service) GetProfile

func (s *Service) GetProfile(userID uint) (*models.User, error)

GetProfile 获取用户资料

func (*Service) GetUserByID

func (s *Service) GetUserByID(userID uint) (*models.User, error)

GetUserByID 根据ID获取用户 (兼容性方法)

func (*Service) GetUserFiles

func (s *Service) GetUserFiles(userID uint, page, limit int) (interface{}, int64, error)

GetUserFiles 获取用户文件列表 (兼容性方法)

func (*Service) GetUserStats

func (s *Service) GetUserStats(userID uint) (*service.UserStatsData, error)

GetUserStats 获取用户统计信息

func (*Service) IsRegistrationAllowed

func (s *Service) IsRegistrationAllowed() bool

IsRegistrationAllowed 检查是否允许注册 (兼容性方法)

func (*Service) IsSystemInitialized

func (s *Service) IsSystemInitialized() (bool, error)

IsSystemInitialized 检测系统是否已初始化(是否有管理员用户)

func (*Service) IsUserSystemEnabled

func (s *Service) IsUserSystemEnabled() bool

IsUserSystemEnabled 检查用户系统是否启用 - 始终返回true

func (*Service) Login

func (s *Service) Login(username, password, ipAddress, userAgent string) (string, *models.User, error)

Login 用户登录并返回token

func (*Service) Logout

func (s *Service) Logout(userID uint) error

Logout 用户登出 (兼容性方法)

func (*Service) NormalizeUsername

func (s *Service) NormalizeUsername(username string) string

NormalizeUsername 规范化用户名

func (*Service) RecalculateAllUsersStats

func (s *Service) RecalculateAllUsersStats() error

RecalculateAllUsersStats 重新计算所有用户的统计数据

func (*Service) RecalculateUserStats

func (s *Service) RecalculateUserStats(userID uint) error

RecalculateUserStats 重新计算用户统计数据

func (*Service) Register

func (s *Service) Register(username, email, password, nickname string) (*models.User, error)

Register 用户注册

func (*Service) UpdateProfile

func (s *Service) UpdateProfile(userID uint, updates map[string]interface{}) error

UpdateProfile 更新用户资料 - 使用结构化更新

func (*Service) UpdateUserProfile

func (s *Service) UpdateUserProfile(userID uint, nickname, avatar string) error

UpdateUserProfile 更新用户资料 (兼容性方法)

func (*Service) UpdateUserStats

func (s *Service) UpdateUserStats(userID uint, statsType string, value int64) error

UpdateUserStats 更新用户统计信息

func (*Service) ValidateToken

func (s *Service) ValidateToken(token string) (interface{}, error)

ValidateToken 验证令牌 (兼容性方法)

func (*Service) ValidateUserInput

func (s *Service) ValidateUserInput(username, email, password string) error

ValidateUserInput 验证用户输入

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL