mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-12-30 11:26:35 +08:00
refactor: remove router、ioc is adjusted to inject by type
This commit is contained in:
@@ -7,7 +7,18 @@ import (
|
||||
"mayfly-go/pkg/utils/collx"
|
||||
)
|
||||
|
||||
func GenerateCaptcha(rc *req.Ctx) {
|
||||
type Captcha struct {
|
||||
}
|
||||
|
||||
func (c *Captcha) ReqConfs() *req.Confs {
|
||||
reqs := [...]*req.Conf{
|
||||
req.NewGet("", c.GenerateCaptcha).DontNeedToken(),
|
||||
}
|
||||
|
||||
return req.NewConfs("/sys/captcha", reqs[:]...)
|
||||
}
|
||||
|
||||
func (c *Captcha) GenerateCaptcha(rc *req.Ctx) {
|
||||
id, image, err := captcha.Generate()
|
||||
biz.ErrIsNilAppendErr(err, "failed to generate the CAPTCHA: %s")
|
||||
rc.ResData = collx.M{"base64Captcha": image, "cid": id}
|
||||
|
||||
Reference in New Issue
Block a user