123456789101112131415161718192021222324252627282930313233343536 |
- package v1
- import (
- "gin-vue-admin/global"
- "gin-vue-admin/global/response"
- resp "gin-vue-admin/model/response"
- "gin-vue-admin/utils"
- "github.com/dchest/captcha"
- "github.com/gin-gonic/gin"
- )
- func Captcha(c *gin.Context) {
- captchaId := captcha.NewLen(global.GVA_CONFIG.Captcha.KeyLong)
- response.OkDetailed(resp.SysCaptchaResponse{
- CaptchaId: captchaId,
- PicPath: "/base/captcha/" + captchaId + ".png",
- }, "验证码获取成功", c)
- }
- func CaptchaImg(c *gin.Context) {
- utils.GinCaptchaServeHTTP(c.Writer, c.Request)
- }
|