mirror of
https://gitcode.com/flipped-aurora/gin-vue-admin.git
synced 2026-05-14 19:28:00 +00:00
增加验证码接口 修改swagger某些参数错误
This commit is contained in:
@@ -1 +1,44 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"gin-vue-admin/controller/servers"
|
||||
"github.com/dchest/captcha"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// 获取图片验证码id
|
||||
// @Tags base
|
||||
// @Summary 生成验证码
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body modelInterface.PageInfo true "生成验证码"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /base/captcha [post]
|
||||
func Captcha(c *gin.Context) {
|
||||
id := captcha.NewLen(6)
|
||||
captcha.Server(captcha.StdWidth,captcha.StdHeight)
|
||||
servers.ReportFormat(c,true,"test",gin.H{
|
||||
"id":id,
|
||||
"picPath":"/base/captcha/"+id+".png",
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags base
|
||||
// @Summary 生成验证码图片路径
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body modelInterface.PageInfo true "生成验证码图片路径"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /base/captcha/:id [get]
|
||||
func CaptchaImg(c *gin.Context) {
|
||||
servers.GinCapthcaServeHTTP(c.Writer, c.Request)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user