From c5e81a8bd646c4be334a00078f39dfc13a4959b0 Mon Sep 17 00:00:00 2001 From: "854350999@qq.com" <854350999@qq.com> Date: Fri, 7 Jan 2022 16:33:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96swagger?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/api/v1/system/sys_captcha.go | 3 ++- server/model/system/response/sys_captcha.go | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/server/api/v1/system/sys_captcha.go b/server/api/v1/system/sys_captcha.go index 763e8ee02..c1b0227c7 100644 --- a/server/api/v1/system/sys_captcha.go +++ b/server/api/v1/system/sys_captcha.go @@ -15,12 +15,13 @@ var store = base64Captcha.DefaultMemStore type BaseApi struct{} +// Captcha // @Tags Base // @Summary 生成验证码 // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Success 200 {string} string "{"success":true,"data":{},"msg":"验证码获取成功"}" +// @Success 200 {object} response.Response{data=systemRes.SysCaptchaResponse} "生成一个随机验证码,返回包括随机生成id,base64 图像字符串,验证码长度" // @Router /base/captcha [post] func (b *BaseApi) Captcha(c *gin.Context) { // 字符,公式,验证码配置 diff --git a/server/model/system/response/sys_captcha.go b/server/model/system/response/sys_captcha.go index 4d482f9cd..22c4dcca9 100644 --- a/server/model/system/response/sys_captcha.go +++ b/server/model/system/response/sys_captcha.go @@ -1,7 +1,7 @@ package response type SysCaptchaResponse struct { - CaptchaId string `json:"captchaId"` - PicPath string `json:"picPath"` - CaptchaLength int `json:"captchaLength""` + CaptchaId string `json:"captchaId" example:"axxbbas"` // 随机数id + PicPath string `json:"picPath" example:"data:img/png;base64,///"` // base64 图像字符串 + CaptchaLength int `json:"captchaLength" example:"6"` // 验证码长度 }