Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
是阿延啊
gin-vue-admin
提交
d1c1f73e
G
gin-vue-admin
项目概览
是阿延啊
/
gin-vue-admin
与 Fork 源项目一致
Fork自
FLIPPED-AURORA / gin-vue-admin
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gin-vue-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d1c1f73e
编写于
3月 17, 2020
作者:
Mr.奇淼(
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加验证码功能
上级
c25013cc
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
2 addition
and
74 deletion
+2
-74
QMPlusServer/controller/api/sys_captcha.go
QMPlusServer/controller/api/sys_captcha.go
+0
-8
QMPlusServer/controller/servers/captcha.go
QMPlusServer/controller/servers/captcha.go
+1
-1
QMPlusServer/docs/docs.go
QMPlusServer/docs/docs.go
+1
-25
QMPlusServer/docs/swagger.json
QMPlusServer/docs/swagger.json
+0
-24
QMPlusServer/docs/swagger.yaml
QMPlusServer/docs/swagger.yaml
+0
-16
未找到文件。
QMPlusServer/controller/api/sys_captcha.go
浏览文件 @
d1c1f73e
package
api
import
(
"fmt"
"gin-vue-admin/controller/servers"
"github.com/dchest/captcha"
"github.com/gin-gonic/gin"
...
...
@@ -13,20 +12,14 @@ import (
// @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
)
{
captchaId
:=
captcha
.
NewLen
(
6
)
if
err
:=
captcha
.
Server
(
captcha
.
StdWidth
,
captcha
.
StdHeight
);
err
!=
nil
{
servers
.
ReportFormat
(
c
,
true
,
fmt
.
Sprintf
(
"验证码获取失败:%v"
,
err
),
gin
.
H
{})
}
else
{
servers
.
ReportFormat
(
c
,
true
,
"验证码获取成功"
,
gin
.
H
{
"captchaId"
:
captchaId
,
"picPath"
:
"/base/captcha/"
+
captchaId
+
".png"
,
})
}
}
// @Tags base
...
...
@@ -34,7 +27,6 @@ func Captcha(c *gin.Context) {
// @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/:captchaId [get]
func
CaptchaImg
(
c
*
gin
.
Context
)
{
...
...
QMPlusServer/controller/servers/captcha.go
浏览文件 @
d1c1f73e
...
...
@@ -25,7 +25,7 @@ func GinCapthcaServeHTTP(w http.ResponseWriter, r *http.Request) {
}
lang
:=
strings
.
ToLower
(
r
.
FormValue
(
"lang"
))
download
:=
path
.
Base
(
dir
)
==
"download"
if
Serve
(
w
,
r
,
id
,
ext
,
lang
,
download
,
captcha
.
StdWidth
,
captcha
.
StdHeight
)
==
captcha
.
ErrNotFound
{
if
Serve
(
w
,
r
,
id
,
ext
,
lang
,
download
,
120
,
40
)
==
captcha
.
ErrNotFound
{
http
.
NotFound
(
w
,
r
)
}
}
...
...
QMPlusServer/docs/docs.go
浏览文件 @
d1c1f73e
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag at
// 2020-03-17 1
4:07:14.3860547 +0800 CST m=+0.0777923
01
// 2020-03-17 1
5:18:08.5115326 +0800 CST m=+0.0987376
01
package
docs
...
...
@@ -421,18 +421,6 @@ var doc = `{
"base"
],
"summary": "生成验证码",
"parameters": [
{
"description": "生成验证码",
"name": "data",
"in": "body",
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/modelInterface.PageInfo"
}
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}",
...
...
@@ -460,18 +448,6 @@ var doc = `{
"base"
],
"summary": "生成验证码图片路径",
"parameters": [
{
"description": "生成验证码图片路径",
"name": "data",
"in": "body",
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/modelInterface.PageInfo"
}
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}",
...
...
QMPlusServer/docs/swagger.json
浏览文件 @
d1c1f73e
...
...
@@ -404,18 +404,6 @@
"base"
],
"summary"
:
"生成验证码"
,
"parameters"
:
[
{
"description"
:
"生成验证码"
,
"name"
:
"data"
,
"in"
:
"body"
,
"required"
:
true
,
"schema"
:
{
"type"
:
"object"
,
"$ref"
:
"#/definitions/modelInterface.PageInfo"
}
}
],
"responses"
:
{
"200"
:
{
"description"
:
"{
\"
success
\"
:true,
\"
data
\"
:{},
\"
msg
\"
:
\"
获取成功
\"
}"
,
...
...
@@ -443,18 +431,6 @@
"base"
],
"summary"
:
"生成验证码图片路径"
,
"parameters"
:
[
{
"description"
:
"生成验证码图片路径"
,
"name"
:
"data"
,
"in"
:
"body"
,
"required"
:
true
,
"schema"
:
{
"type"
:
"object"
,
"$ref"
:
"#/definitions/modelInterface.PageInfo"
}
}
],
"responses"
:
{
"200"
:
{
"description"
:
"{
\"
success
\"
:true,
\"
data
\"
:{},
\"
msg
\"
:
\"
获取成功
\"
}"
,
...
...
QMPlusServer/docs/swagger.yaml
浏览文件 @
d1c1f73e
...
...
@@ -544,14 +544,6 @@ paths:
post
:
consumes
:
-
application/json
parameters
:
-
description
:
生成验证码
in
:
body
name
:
data
required
:
true
schema
:
$ref
:
'
#/definitions/modelInterface.PageInfo'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -568,14 +560,6 @@ paths:
get
:
consumes
:
-
application/json
parameters
:
-
description
:
生成验证码图片路径
in
:
body
name
:
data
required
:
true
schema
:
$ref
:
'
#/definitions/modelInterface.PageInfo'
type
:
object
produces
:
-
application/json
responses
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录