1234567891011121314151617181920212223242526272829303132333435 |
- package api
- import (
- "gin-vue-admin/config"
- "gin-vue-admin/controller/servers"
- "github.com/dchest/captcha"
- "github.com/gin-gonic/gin"
- )
- func Captcha(c *gin.Context) {
- captchaId := captcha.NewLen(config.GinVueAdminconfig.Captcha.KeyLong)
- servers.ReportFormat(c, true, "验证码获取成功", gin.H{
- "captchaId": captchaId,
- "picPath": "/base/captcha/" + captchaId + ".png",
- })
- }
- func CaptchaImg(c *gin.Context) {
- servers.GinCapthcaServeHTTP(c.Writer, c.Request)
- }
|