2021-09-11 14:04:09 +08:00
|
|
|
package api
|
2021-07-28 18:03:19 +08:00
|
|
|
|
|
|
|
|
import (
|
2023-10-26 17:15:49 +08:00
|
|
|
"mayfly-go/pkg/biz"
|
2022-06-02 17:41:11 +08:00
|
|
|
"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"
|
2021-07-28 18:03:19 +08:00
|
|
|
)
|
|
|
|
|
|
2023-01-14 16:29:52 +08:00
|
|
|
func GenerateCaptcha(rc *req.Ctx) {
|
2023-10-26 17:15:49 +08:00
|
|
|
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}
|
2021-07-28 18:03:19 +08:00
|
|
|
}
|