service

package
v0.0.0-...-818921e Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TEXT = "" /* 1461-byte string literal not displayed */
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockPuzzleCaptchaService

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

func NewBlockPuzzleCaptchaService

func NewBlockPuzzleCaptchaService(factory *CaptchaServiceFactory) *BlockPuzzleCaptchaService

func (*BlockPuzzleCaptchaService) Check

func (b *BlockPuzzleCaptchaService) Check(token string, pointJson string) error

func (*BlockPuzzleCaptchaService) Get

func (b *BlockPuzzleCaptchaService) Get() (map[string]interface{}, error)

Get 获取验证码图片信息

func (*BlockPuzzleCaptchaService) Verification

func (b *BlockPuzzleCaptchaService) Verification(token string, pointJson string) error

type CaptchaCacheInterface

type CaptchaCacheInterface interface {
	Get(key string) string
	Set(key string, val string, expiresInSeconds int)
	Delete(key string)
	Exists(key string) bool
	GetType() string
	Increment(key string, val int) int
}

func NewConfigRedisCacheService

func NewConfigRedisCacheService(rdsAddr []string, dbUserName, dbPassword string, enableCluster bool, db int) CaptchaCacheInterface

NewConfigRedisCacheService 初始化自定义redis配置

func NewMemCacheService

func NewMemCacheService(captchaCacheMaxNumber int) CaptchaCacheInterface

type CaptchaInterface

type CaptchaInterface interface {

	// Get 获取验证码
	Get() (map[string]interface{}, error)

	// Check 核对验证码
	Check(token string, pointJson string) error

	// Verification 二次校验验证码(后端)
	Verification(token string, pointJson string) error
}

type CaptchaServiceFactory

type CaptchaServiceFactory struct {
	ServiceMap  map[string]CaptchaInterface
	ServiceLock sync.RWMutex

	CacheMap  map[string]CaptchaCacheInterface
	CacheLock sync.RWMutex
	// contains filtered or unexported fields
}

CaptchaServiceFactory 验证码服务工厂

func NewCaptchaServiceFactory

func NewCaptchaServiceFactory(config *configIns.Config) *CaptchaServiceFactory

func (*CaptchaServiceFactory) GetCache

func (*CaptchaServiceFactory) GetService

func (c *CaptchaServiceFactory) GetService(key string) CaptchaInterface

func (*CaptchaServiceFactory) RegisterCache

func (c *CaptchaServiceFactory) RegisterCache(key string, cacheInterface CaptchaCacheInterface)

func (*CaptchaServiceFactory) RegisterService

func (c *CaptchaServiceFactory) RegisterService(key string, service CaptchaInterface)

type ClickWordCaptchaService

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

func NewClickWordCaptchaService

func NewClickWordCaptchaService(factory *CaptchaServiceFactory) *ClickWordCaptchaService

func (*ClickWordCaptchaService) Check

func (c *ClickWordCaptchaService) Check(token string, pointJson string) error

func (*ClickWordCaptchaService) Get

func (c *ClickWordCaptchaService) Get() (map[string]interface{}, error)

func (*ClickWordCaptchaService) Verification

func (c *ClickWordCaptchaService) Verification(token string, pointJson string) error

type MemCacheService

type MemCacheService struct {
	Cache *util.CacheUtil
}

func (*MemCacheService) Delete

func (l *MemCacheService) Delete(key string)

func (*MemCacheService) Exists

func (l *MemCacheService) Exists(key string) bool

func (*MemCacheService) Get

func (l *MemCacheService) Get(key string) string

func (*MemCacheService) GetType

func (l *MemCacheService) GetType() string

func (*MemCacheService) Increment

func (l *MemCacheService) Increment(key string, val int) int

func (*MemCacheService) Set

func (l *MemCacheService) Set(key string, val string, expiresInSeconds int)

type RedisCacheService

type RedisCacheService struct {
	Cache *util.RedisUtil
}

func (*RedisCacheService) Delete

func (l *RedisCacheService) Delete(key string)

func (*RedisCacheService) Exists

func (l *RedisCacheService) Exists(key string) bool

func (*RedisCacheService) Get

func (l *RedisCacheService) Get(key string) string

func (*RedisCacheService) GetType

func (l *RedisCacheService) GetType() string

func (*RedisCacheService) Increment

func (l *RedisCacheService) Increment(key string, val int) int

func (*RedisCacheService) Set

func (l *RedisCacheService) Set(key string, val string, expiresInSeconds int)

Jump to

Keyboard shortcuts

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