github.com/SupenBysz/gf-admin-community@v0.7.4/sys_service/sys_captcha.go (about)

     1  // ================================================================================
     2  // Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
     3  // You can delete these comments if you wish manually maintain this interface file.
     4  // ================================================================================
     5  
     6  package sys_service
     7  
     8  import (
     9  	"context"
    10  
    11  	"github.com/gogf/gf/v2/net/ghttp"
    12  )
    13  
    14  type (
    15  	ICaptcha interface {
    16  		// MakeCaptcha 创建验证码,直接输出验证码图片内容到HTTP Response.
    17  		MakeCaptcha(ctx context.Context) error
    18  		// VerifyAndClear 校验验证码,并清空缓存的验证码信息
    19  		VerifyAndClear(_ *ghttp.Request, value string) bool
    20  	}
    21  )
    22  
    23  var (
    24  	localCaptcha ICaptcha
    25  )
    26  
    27  func Captcha() ICaptcha {
    28  	if localCaptcha == nil {
    29  		panic("implement not found for interface ICaptcha, forgot register?")
    30  	}
    31  	return localCaptcha
    32  }
    33  
    34  func RegisterCaptcha(i ICaptcha) {
    35  	localCaptcha = i
    36  }