refactor: remove router、ioc is adjusted to inject by type

This commit is contained in:
meilin.huang
2024-12-16 23:29:18 +08:00
parent 7f2a49ba3c
commit 68f553f4b0
142 changed files with 1403 additions and 1905 deletions

View File

@@ -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}