Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CaptchaRepository ¶
type CaptchaRepository struct {
DefaultHeight int // 默认高度 40
DefaultWidth int // 默认宽度 80
DefaultLength int // 默认长度,位数 6
DefaultMaxSkew float64 // 默认倾斜因子 0.7
DefaultDotRate float64 // 默认干扰点比率 25%
DriverAudio *base64Captcha.DriverAudio
DriverString *base64Captcha.DriverString
DriverChinese *base64Captcha.DriverChinese
DriverMath *base64Captcha.DriverMath
DriverDigit *base64Captcha.DriverDigit
// contains filtered or unexported fields
}
验证码仓库
func NewCaptchaRepository ¶
func NewCaptchaRepository() *CaptchaRepository
func (*CaptchaRepository) GetCodeCaptcha ¶
func (rs *CaptchaRepository) GetCodeCaptcha(key string) string
生成随机验证码
func (*CaptchaRepository) GetImageCaptcha ¶
func (*CaptchaRepository) VerifyCaptcha ¶
func (rs *CaptchaRepository) VerifyCaptcha(id string, answer string) bool
验证验证码
type RedisStore ¶
type RedisStore struct {
Redis *redis.Client // 缓存 15分钟
Expiration time.Duration // 过期时间
PrefixKey string // 前缀
Context context.Context
}
验证码存储
func NewDefaultRedisStore ¶
func NewDefaultRedisStore() *RedisStore
Click to show internal directories.
Click to hide internal directories.