gin-vue-admin 2.0代码重构
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
package api
|
||||
package v1
|
||||
|
||||
import (
|
||||
"gin-vue-admin/config"
|
||||
"gin-vue-admin/controller/servers"
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/global/response"
|
||||
"gin-vue-admin/utils"
|
||||
"github.com/dchest/captcha"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
@@ -16,11 +17,11 @@ import (
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /base/captcha [post]
|
||||
func Captcha(c *gin.Context) {
|
||||
captchaId := captcha.NewLen(config.GinVueAdminconfig.Captcha.KeyLong)
|
||||
servers.ReportFormat(c, true, "验证码获取成功", gin.H{
|
||||
captchaId := captcha.NewLen(global.GVA_CONFIG.Captcha.KeyLong)
|
||||
response.Result(response.SUCCESS, gin.H{
|
||||
"captchaId": captchaId,
|
||||
"picPath": "/base/captcha/" + captchaId + ".png",
|
||||
})
|
||||
}, "验证码获取成功", c)
|
||||
}
|
||||
|
||||
// @Tags base
|
||||
@@ -31,5 +32,5 @@ func Captcha(c *gin.Context) {
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /base/captcha/:captchaId [get]
|
||||
func CaptchaImg(c *gin.Context) {
|
||||
servers.GinCapthcaServeHTTP(c.Writer, c.Request)
|
||||
utils.GinCaptchaServeHTTP(c.Writer, c.Request)
|
||||
}
|
||||
|
Reference in New Issue
Block a user