action

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

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 (cs *CaptchaService) ActionRecordAdd(ctx context.Context, actionType string, ip string) (int, error)

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 (cs *CaptchaService) UserRegisterVerifyCaptcha(
	ctx context.Context, id string, VerifyValue string,
) bool

func (*CaptchaService) VerifyCaptcha

func (cs *CaptchaService) VerifyCaptcha(ctx context.Context, key, captcha string) (isCorrect bool, err error)

VerifyCaptcha generate captcha

Jump to

Keyboard shortcuts

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