Documentation ¶
Index ¶
- type CaptchaRepo
- type CaptchaService
- func (cs *CaptchaService) ActionRecord(ctx context.Context, req *schema.ActionRecordReq) (resp *schema.ActionRecordResp, err error)
- func (cs *CaptchaService) ActionRecordAdd(ctx context.Context, actionType string, ip string) (int, error)
- func (cs *CaptchaService) ActionRecordDel(ctx context.Context, actionType string, ip string)
- func (cs *CaptchaService) ActionRecordVerifyCaptcha(ctx context.Context, actionType string, ip string, id string, ...) bool
- func (cs *CaptchaService) GenerateCaptcha(ctx context.Context) (key, captchaBase64 string, err error)
- func (cs *CaptchaService) UserRegisterCaptcha(ctx context.Context) (resp *schema.ActionRecordResp, err error)
- func (cs *CaptchaService) UserRegisterVerifyCaptcha(ctx context.Context, id string, VerifyValue string) bool
- func (cs *CaptchaService) VerifyCaptcha(ctx context.Context, key, captcha string) (isCorrect bool, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CaptchaRepo ¶
type CaptchaRepo interface { SetCaptcha(ctx context.Context, key, captcha string) (err error) GetCaptcha(ctx context.Context, key string) (captcha string, err error) DelCaptcha(ctx context.Context, key string) (err error) SetActionType(ctx context.Context, ip, actionType string, amount int) (err error) GetActionType(ctx context.Context, ip, actionType string) (amount int, err error) DelActionType(ctx context.Context, ip, actionType string) (err error) }
CaptchaRepo captcha repository
type CaptchaService ¶
type CaptchaService struct {
// contains filtered or unexported fields
}
CaptchaService kit service
func NewCaptchaService ¶
func NewCaptchaService(captchaRepo CaptchaRepo) *CaptchaService
NewCaptchaService captcha service
func (*CaptchaService) ActionRecord ¶
func (cs *CaptchaService) ActionRecord(ctx context.Context, req *schema.ActionRecordReq) (resp *schema.ActionRecordResp, err error)
ActionRecord action record
func (*CaptchaService) ActionRecordAdd ¶
func (*CaptchaService) ActionRecordDel ¶
func (cs *CaptchaService) ActionRecordDel(ctx context.Context, actionType string, ip string)
func (*CaptchaService) ActionRecordVerifyCaptcha ¶
func (cs *CaptchaService) ActionRecordVerifyCaptcha( ctx context.Context, actionType string, ip string, id string, VerifyValue string, ) bool
ActionRecordVerifyCaptcha Verify that you need to enter a CAPTCHA, and that the CAPTCHA is correct
func (*CaptchaService) GenerateCaptcha ¶
func (cs *CaptchaService) GenerateCaptcha(ctx context.Context) (key, captchaBase64 string, err error)
GenerateCaptcha generate captcha
func (*CaptchaService) UserRegisterCaptcha ¶ added in v1.0.0
func (cs *CaptchaService) UserRegisterCaptcha(ctx context.Context) (resp *schema.ActionRecordResp, err error)
func (*CaptchaService) UserRegisterVerifyCaptcha ¶ added in v1.0.0
func (*CaptchaService) VerifyCaptcha ¶
func (cs *CaptchaService) VerifyCaptcha(ctx context.Context, key, captcha string) (isCorrect bool, err error)
VerifyCaptcha generate captcha
Click to show internal directories.
Click to hide internal directories.