package biz import ( "context" "time" ) type Dictionary struct { ID uint CreatedAt time.Time UpdatedAt time.Time Name string Type string Status bool Desc string ParentID *uint Children []*Dictionary Details []*DictionaryDetail } type DictionaryDetail struct { ID uint CreatedAt time.Time UpdatedAt time.Time Label string Value string Extend string Status bool Sort int DictionaryID uint ParentID *uint Level int Path string Children []*DictionaryDetail } type SystemParameter struct { ID uint CreatedAt time.Time UpdatedAt time.Time Name string Key string Value string Desc string } type APIToken struct { ID uint CreatedAt time.Time UpdatedAt time.Time UserID uint AuthorityID uint Token string Status bool ExpiresAt time.Time Remark string User *User } type SecurityConfig struct { ID uint CaptchaOpen int CaptchaTimeout int KeyLong int ImgWidth int ImgHeight int PwdMinLength int PwdRequireUpper bool PwdRequireLower bool PwdRequireDigit bool PwdRequireSpecial bool LimitEnable bool LimitWindow int LimitCount int LockEnable bool LockThreshold int LockDuration int PwdExpireEnable bool PwdExpireDays int ForceNewUserChangePassword bool } type SettingsRepo interface { CreateDictionary(context.Context, *Dictionary) error UpdateDictionary(context.Context, *Dictionary) error DeleteDictionary(context.Context, uint) error FindDictionary(context.Context, uint, string, bool) (*Dictionary, error) ListDictionaries(context.Context, int, int, string, string, bool) ([]*Dictionary, int64, error) CreateDictionaryDetail(context.Context, *DictionaryDetail) error UpdateDictionaryDetail(context.Context, *DictionaryDetail) error DeleteDictionaryDetail(context.Context, uint) error FindDictionaryDetail(context.Context, uint) (*DictionaryDetail, error) ListDictionaryDetails(context.Context, int, int, uint, string, string) ([]*DictionaryDetail, int64, error) DictionaryDetailTree(context.Context, uint, string) ([]*DictionaryDetail, error) CreateParameter(context.Context, *SystemParameter) error UpdateParameter(context.Context, *SystemParameter) error DeleteParameters(context.Context, []uint) error FindParameter(context.Context, uint, string) (*SystemParameter, error) ListParameters(context.Context, int, int, *SystemParameter) ([]*SystemParameter, int64, error) UserHasAuthority(context.Context, uint, uint) (*User, bool, error) CreateAPIToken(context.Context, *APIToken) error ListAPITokens(context.Context, int, int, uint, *bool) ([]*APIToken, int64, error) DisableAPIToken(context.Context, uint) (string, error) IsTokenDisabled(context.Context, string) (bool, error) SecurityConfig(context.Context) (*SecurityConfig, error) SaveSecurityConfig(context.Context, *SecurityConfig) error } type SettingsUsecase struct{ repo SettingsRepo } func NewSettingsUsecase(repo SettingsRepo) *SettingsUsecase { return &SettingsUsecase{repo: repo} } func (uc *SettingsUsecase) Repo() SettingsRepo { return uc.repo }