common

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ads

type Ads struct {
	ID          int64
	Title       string
	Type        string
	Content     string
	Description string
	TargetURL   string
	StartTime   int64
	EndTime     int64
	Status      int
	CreatedAt   int64
	UpdatedAt   int64
}

Ads contains ads information

type AuthConfig

type AuthConfig struct {
	Mobile   *conf.MobileAuth
	Email    *conf.EmailAuth
	Device   *DeviceAuthConfig
	Register *conf.Register
}

AuthConfig combines auth-related configurations

type CommonRepo

type CommonRepo interface {
	// GetAdsList gets ads list by status
	GetAdsList(ctx context.Context, status int) ([]*Ads, error)
	// GetClientList gets subscribe application list
	GetClientList(ctx context.Context) ([]*SubscribeClient, error)
	// GetTosConfig gets TOS/Privacy config from system table
	GetTosConfig(ctx context.Context, key string) (string, error)
	// GetSystemConfigByCategory gets system config by category
	GetSystemConfigByCategory(ctx context.Context, category string) (map[string]string, error)
	// GetWebAdConfig gets WebAD config
	GetWebAdConfig(ctx context.Context) (bool, error)
	// GetEnabledAuthMethods gets enabled auth methods
	GetEnabledAuthMethods(ctx context.Context) ([]string, error)
	// GetStatistics gets system statistics (user count, node count, etc.)
	GetStatistics(ctx context.Context) (*Statistics, error)
	// SendEmailVerificationCode sends email verification code
	SendEmailVerificationCode(ctx context.Context, email string, verifyType int32) error
	// SendSmsVerificationCode sends SMS verification code
	SendSmsVerificationCode(ctx context.Context, telephone, telephoneArea string, verifyType int32) (code string, err error)
	// CheckVerificationCode checks verification code
	CheckVerificationCode(ctx context.Context, method, account, code string, verifyType int32) (bool, error)
}

CommonRepo defines repository interface for common operations

type CommonUsecase

type CommonUsecase struct {
	// contains filtered or unexported fields
}

CommonUsecase handles common business logic

func NewCommonUsecase

func NewCommonUsecase(repo CommonRepo, c *conf.Application, logger log.Logger) *CommonUsecase

NewCommonUsecase creates a new common usecase

func (*CommonUsecase) CheckVerificationCode

func (uc *CommonUsecase) CheckVerificationCode(ctx context.Context, method, account, code string, verifyType int32) (bool, error)

CheckVerificationCode checks verification code

func (*CommonUsecase) GetAds

func (uc *CommonUsecase) GetAds(ctx context.Context, device, position string) ([]*Ads, error)

GetAds gets ads list

func (*CommonUsecase) GetClient

func (uc *CommonUsecase) GetClient(ctx context.Context) ([]*SubscribeClient, int32, error)

GetClient gets subscribe client list

func (*CommonUsecase) GetGlobalConfig

func (uc *CommonUsecase) GetGlobalConfig(ctx context.Context) (*GlobalConfig, error)

GetGlobalConfig gets global configuration

func (*CommonUsecase) GetPrivacyPolicy

func (uc *CommonUsecase) GetPrivacyPolicy(ctx context.Context) (string, error)

GetPrivacyPolicy gets privacy policy content

func (*CommonUsecase) GetStat

func (uc *CommonUsecase) GetStat(ctx context.Context) (*Statistics, error)

GetStat gets system statistics

func (*CommonUsecase) GetTos

func (uc *CommonUsecase) GetTos(ctx context.Context) (string, error)

GetTos gets terms of service content

func (*CommonUsecase) SendEmailCode

func (uc *CommonUsecase) SendEmailCode(ctx context.Context, email string, verifyType int32) error

SendEmailCode sends email verification code

func (*CommonUsecase) SendSmsCode

func (uc *CommonUsecase) SendSmsCode(ctx context.Context, telephone, telephoneArea string, verifyType int32) (string, error)

SendSmsCode sends SMS verification code

type DeviceAuthConfig

type DeviceAuthConfig struct {
	Enable         bool
	ShowAds        bool
	EnableSecurity bool
	OnlyRealDevice bool
}
type DownloadLink struct {
	IOS     string
	Android string
	Windows string
	Mac     string
	Linux   string
	Harmony string
}

DownloadLink contains platform-specific download links

type GlobalConfig

type GlobalConfig struct {
	Site         *conf.Site
	Verify       *VerifyConfig
	Auth         *AuthConfig
	Invite       *conf.Invite
	Currency     map[string]string
	Subscribe    *conf.Subscribe
	VerifyCode   map[string]string
	OAuthMethods []string
	WebAd        bool
}

GlobalConfig represents complete global configuration

type Statistics

type Statistics struct {
	User     int64
	Node     int64
	Country  int64
	Protocol []string
}

Statistics contains system statistics information

type SubscribeClient

type SubscribeClient struct {
	ID           int64
	Name         string
	Description  string
	Icon         string
	Scheme       string
	IsDefault    bool
	DownloadLink DownloadLink
}

SubscribeClient contains subscribe application information

type VerifyConfig

type VerifyConfig struct {
	CaptchaType                    string
	TurnstileSiteKey               string
	EnableUserLoginVerify          bool
	EnableUserRegisterVerify       bool
	EnableAdminLoginCaptcha        bool
	EnableUserResetPasswordCaptcha bool
}

Jump to

Keyboard shortcuts

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