Files
mayfly-go/server/internal/sys/api/captcha.go

15 lines
320 B
Go
Raw Normal View History

2021-09-11 14:04:09 +08:00
package api
import (
"mayfly-go/pkg/biz"
"mayfly-go/pkg/captcha"
2023-01-14 16:29:52 +08:00
"mayfly-go/pkg/req"
2023-10-12 12:14:56 +08:00
"mayfly-go/pkg/utils/collx"
)
2023-01-14 16:29:52 +08:00
func GenerateCaptcha(rc *req.Ctx) {
id, image, err := captcha.Generate()
2024-11-20 22:43:53 +08:00
biz.ErrIsNilAppendErr(err, "failed to generate the CAPTCHA: %s")
2023-10-12 12:14:56 +08:00
rc.ResData = collx.M{"base64Captcha": image, "cid": id}
}