Unifies the output of the routing layer and the isolated response structure

This commit is contained in:
Granty1
2020-04-08 14:00:08 +08:00
parent 5d222585dd
commit 4277505c6a
24 changed files with 250 additions and 121 deletions
+4 -3
View File
@@ -3,6 +3,7 @@ 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"
@@ -17,9 +18,9 @@ import (
// @Router /base/captcha [post]
func Captcha(c *gin.Context) {
captchaId := captcha.NewLen(global.GVA_CONFIG.Captcha.KeyLong)
response.Result(response.SUCCESS, gin.H{
"captchaId": captchaId,
"picPath": "/base/captcha/" + captchaId + ".png",
response.OkDetailed(resp.SysCaptchaResponse{
CaptchaId: captchaId,
PicPath: "/base/captcha/" + captchaId + ".png",
}, "验证码获取成功", c)
}