gin-vue-admin 2.0代码重构

This commit is contained in:
QM303176530
2020-04-04 21:39:27 +08:00
parent 1b9adea284
commit 6db275ca39
9 changed files with 26 additions and 25 deletions

View File

@@ -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)
}