github.com/mojocn/base64Captcha
func GetCaptcha(c *gin.Context){
driver := base64Captcha.NewDriverDigit(80, 240, 5, 0.7, 80)
cp := base64Captcha.NewCaptcha(driver, store)
id, b64s, err := cp.Generate()
if err != nil {
zap.S().Errorf("生成验证码错误: %s", err.Error())
c.JSON(http.StatusInternalServerError, gin.H{
"msg":"生成验证码错误",
})
return
}
c.JSON(http.StatusOK, gin.H{
"captchaId": id,
"picPath": b64s,
})
}