✨ encapsulate Redis base function
This commit is contained in:
@@ -2,13 +2,13 @@ package api
|
||||
|
||||
import (
|
||||
"schisandra-cloud-album/api/auth_api"
|
||||
//"schisandra-cloud-album/api/captcha_api"
|
||||
"schisandra-cloud-album/api/captcha_api"
|
||||
)
|
||||
|
||||
// Apis 统一导出的api
|
||||
type Apis struct {
|
||||
AuthApi auth_api.AuthAPI
|
||||
//CaptchaAPI captcha_api.CaptchaAPI
|
||||
AuthApi auth_api.AuthAPI
|
||||
CaptchaAPI captcha_api.CaptchaAPI
|
||||
}
|
||||
|
||||
// Api new函数实例化,实例化完成后会返回结构体地指针类型
|
||||
|
@@ -1,3 +1,3 @@
|
||||
package main
|
||||
package captcha_api
|
||||
|
||||
type CaptchaAPI struct{}
|
@@ -1,22 +1,16 @@
|
||||
package main
|
||||
package captcha_api
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/wenlng/go-captcha/v2/base/option"
|
||||
"github.com/wenlng/go-captcha/v2/click"
|
||||
"log"
|
||||
"schisandra-cloud-album/global"
|
||||
)
|
||||
|
||||
var textCapt click.Captcha
|
||||
|
||||
func init() {
|
||||
|
||||
}
|
||||
|
||||
func main() {
|
||||
captData, err := textCapt.Generate()
|
||||
// GenerateTextCaptcha 生成文本验证码
|
||||
func GenerateTextCaptcha() {
|
||||
captData, err := global.TextCaptcha.Generate()
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user