Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梁国权
gin-vue-admin
提交
4ebd90e0
G
gin-vue-admin
项目概览
梁国权
/
gin-vue-admin
与 Fork 源项目一致
Fork自
FLIPPED-AURORA / gin-vue-admin
通知
2
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,发现更多精彩内容 >>
提交
4ebd90e0
编写于
10月 26, 2019
作者:
Mr.奇淼(
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
图片上传示例 前端图片跨域下载示例 文档更新
上级
dd209669
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
1107 addition
and
54 deletion
+1107
-54
QMPlusServer/controller/api/fileUploadAndDownload.go
QMPlusServer/controller/api/fileUploadAndDownload.go
+68
-0
QMPlusServer/docs/docs.go
QMPlusServer/docs/docs.go
+374
-16
QMPlusServer/docs/swagger.json
QMPlusServer/docs/swagger.json
+373
-15
QMPlusServer/docs/swagger.yaml
QMPlusServer/docs/swagger.yaml
+235
-15
QMPlusServer/go.mod
QMPlusServer/go.mod
+2
-0
QMPlusServer/init/initRouter/initRouter.go
QMPlusServer/init/initRouter/initRouter.go
+6
-6
QMPlusServer/init/registTable/registTable.go
QMPlusServer/init/registTable/registTable.go
+1
-1
QMPlusServer/model/dbModel/fileUploadAndDown.go
QMPlusServer/model/dbModel/fileUploadAndDown.go
+0
-1
QMPlusServer/model/dbModel/fileUploadAndDownload.go
QMPlusServer/model/dbModel/fileUploadAndDownload.go
+33
-0
QMPlusServer/router/fileUploadAndDownload.go
QMPlusServer/router/fileUploadAndDownload.go
+15
-0
未找到文件。
QMPlusServer/controller/api/fileUploadAndDownload.go
0 → 100644
浏览文件 @
4ebd90e0
package
api
import
(
"fmt"
"github.com/gin-gonic/gin"
"main/controller/servers"
"main/model/dbModel"
"main/model/modelInterface"
"strings"
)
// @Tags FileUploadAndDownload
// @Summary 上传文件示例
// @Security ApiKeyAuth
// @accept multipart/form-data
// @Produce application/json
// @Param file formData file true "上传文件示例"
// @Success 200 {string} json "{"success":true,"data":{},"msg":"上传成功"}"
// @Router /fileUploadAndDownload/upload [post]
func
UploadFile
(
c
*
gin
.
Context
)
{
_
,
header
,
err
:=
c
.
Request
.
FormFile
(
"file"
)
if
err
!=
nil
{
servers
.
ReportFormat
(
c
,
false
,
fmt
.
Sprintf
(
"上传文件失败,%v"
,
err
),
gin
.
H
{})
}
else
{
//文件上传后拿到文件路径
err
,
filePath
:=
servers
.
Upload
(
header
,
USER_HEADER_BUCKET
,
USER_HEADER_IMG_PATH
)
if
err
!=
nil
{
servers
.
ReportFormat
(
c
,
false
,
fmt
.
Sprintf
(
"接收返回值失败,%v"
,
err
),
gin
.
H
{})
}
else
{
//修改数据库后得到修改后的user并且返回供前端使用
var
file
dbModel
.
FileUploadAndDownload
file
.
Url
=
filePath
file
.
Name
=
header
.
Filename
s
:=
strings
.
Split
(
file
.
Name
,
"."
)
file
.
Tag
=
s
[
len
(
s
)
-
1
]
err
:=
file
.
Upload
()
if
err
!=
nil
{
servers
.
ReportFormat
(
c
,
false
,
fmt
.
Sprintf
(
"修改数据库链接失败,%v"
,
err
),
gin
.
H
{})
}
else
{
servers
.
ReportFormat
(
c
,
true
,
"上传成功"
,
gin
.
H
{
"file"
:
file
})
}
}
}
}
// @Tags FileUploadAndDownload
// @Summary 分页文件列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body modelInterface.PageInfo true "分页获取文件户列表"
// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /fileUploadAndDownload/getFileList [post]
func
GetFileList
(
c
*
gin
.
Context
)
{
var
pageInfo
modelInterface
.
PageInfo
_
=
c
.
BindJSON
(
&
pageInfo
)
err
,
list
,
total
:=
new
(
dbModel
.
FileUploadAndDownload
)
.
GetInfoList
(
pageInfo
)
if
err
!=
nil
{
servers
.
ReportFormat
(
c
,
false
,
fmt
.
Sprintf
(
"获取数据失败,%v"
,
err
),
gin
.
H
{})
}
else
{
servers
.
ReportFormat
(
c
,
true
,
"获取数据成功"
,
gin
.
H
{
"list"
:
list
,
"total"
:
total
,
"page"
:
pageInfo
.
Page
,
"pageSize"
:
pageInfo
.
PageSize
,
})
}
}
QMPlusServer/docs/docs.go
浏览文件 @
4ebd90e0
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag at
// This file was generated by swaggo/swag at
// 2019-
09-22 17:09:11.1201116 +0800 CST m=+0.0668203
01
// 2019-
10-26 23:18:53.1133875 +0800 CST m=+0.2035665
01
package
docs
package
docs
...
@@ -90,7 +90,7 @@ var doc = `{
...
@@ -90,7 +90,7 @@ var doc = `{
"required": true,
"required": true,
"schema": {
"schema": {
"type": "object",
"type": "object",
"$ref": "#/definitions/
api.DeleteApiParams
"
"$ref": "#/definitions/
dbModel.Api
"
}
}
}
}
],
],
...
@@ -104,7 +104,7 @@ var doc = `{
...
@@ -104,7 +104,7 @@ var doc = `{
}
}
}
}
},
},
"/api/getA
piList
": {
"/api/getA
llApis
": {
"post": {
"post": {
"security": [
"security": [
{
{
...
@@ -120,7 +120,34 @@ var doc = `{
...
@@ -120,7 +120,34 @@ var doc = `{
"tags": [
"tags": [
"Api"
"Api"
],
],
"summary": "分页获取角色列表",
"summary": "获取所有的Api 不分页",
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/api/getApiById": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Api"
],
"summary": "根据id获取api",
"parameters": [
"parameters": [
{
{
"description": "分页获取用户列表",
"description": "分页获取用户列表",
...
@@ -143,7 +170,46 @@ var doc = `{
...
@@ -143,7 +170,46 @@ var doc = `{
}
}
}
}
},
},
"/api/setAuthAndPath": {
"/api/getApiList": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Api"
],
"summary": "分页获取API列表",
"parameters": [
{
"description": "分页获取API列表",
"name": "data",
"in": "body",
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/modelInterface.PageInfo"
}
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/api/setAuthAndApi": {
"post": {
"post": {
"security": [
"security": [
{
{
...
@@ -182,6 +248,45 @@ var doc = `{
...
@@ -182,6 +248,45 @@ var doc = `{
}
}
}
}
},
},
"/api/updataApi": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Api"
],
"summary": "创建基础api",
"parameters": [
{
"description": "创建api",
"name": "data",
"in": "body",
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/api.CreateApiParams"
}
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/authority/createAuthority": {
"/authority/createAuthority": {
"post": {
"post": {
"security": [
"security": [
...
@@ -260,6 +365,45 @@ var doc = `{
...
@@ -260,6 +365,45 @@ var doc = `{
}
}
}
}
},
},
"/authority/getAuthAndApi": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"authority"
],
"summary": "获取本角色所有有权限的apiId",
"parameters": [
{
"description": "获取本角色所有有权限的apiId",
"name": "data",
"in": "body",
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/api.GetAuthorityId"
}
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/authority/getAuthorityList": {
"/authority/getAuthorityList": {
"post": {
"post": {
"security": [
"security": [
...
@@ -361,6 +505,81 @@ var doc = `{
...
@@ -361,6 +505,81 @@ var doc = `{
}
}
}
}
},
},
"/fileUploadAndDownload/getFileList": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"FileUploadAndDownload"
],
"summary": "分页文件列表",
"parameters": [
{
"description": "分页获取文件户列表",
"name": "data",
"in": "body",
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/modelInterface.PageInfo"
}
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/fileUploadAndDownload/upload": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"multipart/form-data"
],
"produces": [
"application/json"
],
"tags": [
"FileUploadAndDownload"
],
"summary": "上传文件示例",
"parameters": [
{
"type": "file",
"description": "上传文件示例",
"name": "file",
"in": "formData",
"required": true
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"上传成功\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/menu/addBaseMenu": {
"/menu/addBaseMenu": {
"post": {
"post": {
"security": [
"security": [
...
@@ -377,16 +596,16 @@ var doc = `{
...
@@ -377,16 +596,16 @@ var doc = `{
"tags": [
"tags": [
"menu"
"menu"
],
],
"summary": "
分页获取基础menu列表
",
"summary": "
新增菜单
",
"parameters": [
"parameters": [
{
{
"description": "
分页获取基础menu列表
",
"description": "
新增菜单
",
"name": "data",
"name": "data",
"in": "body",
"in": "body",
"required": true,
"required": true,
"schema": {
"schema": {
"type": "object",
"type": "object",
"$ref": "#/definitions/
modelInterface.PageInfo
"
"$ref": "#/definitions/
dbModel.BaseMenu
"
}
}
}
}
],
],
...
@@ -455,7 +674,7 @@ var doc = `{
...
@@ -455,7 +674,7 @@ var doc = `{
"tags": [
"tags": [
"menu"
"menu"
],
],
"summary": "
获取指定角色menu
",
"summary": "
删除菜单
",
"parameters": [
"parameters": [
{
{
"description": "删除菜单",
"description": "删除菜单",
...
@@ -478,6 +697,45 @@ var doc = `{
...
@@ -478,6 +697,45 @@ var doc = `{
}
}
}
}
},
},
"/menu/getBaseMenuById": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"menu"
],
"summary": "根据id获取菜单",
"parameters": [
{
"description": "根据id获取菜单",
"name": "data",
"in": "body",
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/api.GetById"
}
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/menu/getBaseMenuTree": {
"/menu/getBaseMenuTree": {
"post": {
"post": {
"security": [
"security": [
...
@@ -589,6 +847,45 @@ var doc = `{
...
@@ -589,6 +847,45 @@ var doc = `{
}
}
}
}
},
},
"/menu/updataBaseMen": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"menu"
],
"summary": "更新菜单",
"parameters": [
{
"description": "更新菜单",
"name": "data",
"in": "body",
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/dbModel.BaseMenu"
}
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/user/changePassword": {
"/user/changePassword": {
"post": {
"post": {
"security": [
"security": [
...
@@ -625,7 +922,7 @@ var doc = `{
...
@@ -625,7 +922,7 @@ var doc = `{
}
}
}
}
},
},
"/user/get
Info
List": {
"/user/get
User
List": {
"post": {
"post": {
"security": [
"security": [
{
{
...
@@ -664,6 +961,45 @@ var doc = `{
...
@@ -664,6 +961,45 @@ var doc = `{
}
}
}
}
},
},
"/user/setUserAuthority": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"User"
],
"summary": "设置用户权限",
"parameters": [
{
"description": "设置用户权限",
"name": "data",
"in": "body",
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/api.SetUserAuth"
}
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"修改成功\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/user/uploadHeaderImg": {
"/user/uploadHeaderImg": {
"post": {
"post": {
"security": [
"security": [
...
@@ -726,10 +1062,10 @@ var doc = `{
...
@@ -726,10 +1062,10 @@ var doc = `{
"api.AuthAndPathIn": {
"api.AuthAndPathIn": {
"type": "object",
"type": "object",
"properties": {
"properties": {
"apis": {
"api
Id
s": {
"type": "array",
"type": "array",
"items": {
"items": {
"
$ref": "#/definitions/dbModel.Api
"
"
type": "integer
"
}
}
},
},
"authorityId": {
"authorityId": {
...
@@ -781,19 +1117,27 @@ var doc = `{
...
@@ -781,19 +1117,27 @@ var doc = `{
}
}
}
}
},
},
"api.DeleteA
piPar
ams": {
"api.DeleteA
uthorityPat
ams": {
"type": "object",
"type": "object",
"properties": {
"properties": {
"
path
": {
"
authorityId
": {
"type": "integer"
"type": "integer"
}
}
}
}
},
},
"api.
DeleteAuthorityPatams
": {
"api.
GetAuthorityId
": {
"type": "object",
"type": "object",
"properties": {
"properties": {
"authorityId": {
"authorityId": {
"type": "integer"
"type": "string"
}
}
},
"api.GetById": {
"type": "object",
"properties": {
"id": {
"type": "number"
}
}
}
}
},
},
...
@@ -816,12 +1160,26 @@ var doc = `{
...
@@ -816,12 +1160,26 @@ var doc = `{
}
}
}
}
},
},
"api.SetUserAuth": {
"type": "object",
"properties": {
"authorityId": {
"type": "string"
},
"uuid": {
"type": "string"
}
}
},
"dbModel.Api": {
"dbModel.Api": {
"type": "object",
"type": "object",
"properties": {
"properties": {
"description": {
"description": {
"type": "string"
"type": "string"
},
},
"group": {
"type": "string"
},
"path": {
"path": {
"type": "string"
"type": "string"
}
}
...
...
QMPlusServer/docs/swagger.json
浏览文件 @
4ebd90e0
...
@@ -73,7 +73,7 @@
...
@@ -73,7 +73,7 @@
"required"
:
true
,
"required"
:
true
,
"schema"
:
{
"schema"
:
{
"type"
:
"object"
,
"type"
:
"object"
,
"$ref"
:
"#/definitions/
api.DeleteApiParams
"
"$ref"
:
"#/definitions/
dbModel.Api
"
}
}
}
}
],
],
...
@@ -87,7 +87,7 @@
...
@@ -87,7 +87,7 @@
}
}
}
}
},
},
"/api/getA
piList
"
:
{
"/api/getA
llApis
"
:
{
"post"
:
{
"post"
:
{
"security"
:
[
"security"
:
[
{
{
...
@@ -103,7 +103,34 @@
...
@@ -103,7 +103,34 @@
"tags"
:
[
"tags"
:
[
"Api"
"Api"
],
],
"summary"
:
"分页获取角色列表"
,
"summary"
:
"获取所有的Api 不分页"
,
"responses"
:
{
"200"
:
{
"description"
:
"{
\"
success
\"
:true,
\"
data
\"
:{},
\"
msg
\"
:
\"
获取成功
\"
}"
,
"schema"
:
{
"type"
:
"string"
}
}
}
}
},
"/api/getApiById"
:
{
"post"
:
{
"security"
:
[
{
"ApiKeyAuth"
:
[]
}
],
"consumes"
:
[
"application/json"
],
"produces"
:
[
"application/json"
],
"tags"
:
[
"Api"
],
"summary"
:
"根据id获取api"
,
"parameters"
:
[
"parameters"
:
[
{
{
"description"
:
"分页获取用户列表"
,
"description"
:
"分页获取用户列表"
,
...
@@ -126,7 +153,46 @@
...
@@ -126,7 +153,46 @@
}
}
}
}
},
},
"/api/setAuthAndPath"
:
{
"/api/getApiList"
:
{
"post"
:
{
"security"
:
[
{
"ApiKeyAuth"
:
[]
}
],
"consumes"
:
[
"application/json"
],
"produces"
:
[
"application/json"
],
"tags"
:
[
"Api"
],
"summary"
:
"分页获取API列表"
,
"parameters"
:
[
{
"description"
:
"分页获取API列表"
,
"name"
:
"data"
,
"in"
:
"body"
,
"required"
:
true
,
"schema"
:
{
"type"
:
"object"
,
"$ref"
:
"#/definitions/modelInterface.PageInfo"
}
}
],
"responses"
:
{
"200"
:
{
"description"
:
"{
\"
success
\"
:true,
\"
data
\"
:{},
\"
msg
\"
:
\"
获取成功
\"
}"
,
"schema"
:
{
"type"
:
"string"
}
}
}
}
},
"/api/setAuthAndApi"
:
{
"post"
:
{
"post"
:
{
"security"
:
[
"security"
:
[
{
{
...
@@ -165,6 +231,45 @@
...
@@ -165,6 +231,45 @@
}
}
}
}
},
},
"/api/updataApi"
:
{
"post"
:
{
"security"
:
[
{
"ApiKeyAuth"
:
[]
}
],
"consumes"
:
[
"application/json"
],
"produces"
:
[
"application/json"
],
"tags"
:
[
"Api"
],
"summary"
:
"创建基础api"
,
"parameters"
:
[
{
"description"
:
"创建api"
,
"name"
:
"data"
,
"in"
:
"body"
,
"required"
:
true
,
"schema"
:
{
"type"
:
"object"
,
"$ref"
:
"#/definitions/api.CreateApiParams"
}
}
],
"responses"
:
{
"200"
:
{
"description"
:
"{
\"
success
\"
:true,
\"
data
\"
:{},
\"
msg
\"
:
\"
获取成功
\"
}"
,
"schema"
:
{
"type"
:
"string"
}
}
}
}
},
"/authority/createAuthority"
:
{
"/authority/createAuthority"
:
{
"post"
:
{
"post"
:
{
"security"
:
[
"security"
:
[
...
@@ -243,6 +348,45 @@
...
@@ -243,6 +348,45 @@
}
}
}
}
},
},
"/authority/getAuthAndApi"
:
{
"post"
:
{
"security"
:
[
{
"ApiKeyAuth"
:
[]
}
],
"consumes"
:
[
"application/json"
],
"produces"
:
[
"application/json"
],
"tags"
:
[
"authority"
],
"summary"
:
"获取本角色所有有权限的apiId"
,
"parameters"
:
[
{
"description"
:
"获取本角色所有有权限的apiId"
,
"name"
:
"data"
,
"in"
:
"body"
,
"required"
:
true
,
"schema"
:
{
"type"
:
"object"
,
"$ref"
:
"#/definitions/api.GetAuthorityId"
}
}
],
"responses"
:
{
"200"
:
{
"description"
:
"{
\"
success
\"
:true,
\"
data
\"
:{},
\"
msg
\"
:
\"
获取成功
\"
}"
,
"schema"
:
{
"type"
:
"string"
}
}
}
}
},
"/authority/getAuthorityList"
:
{
"/authority/getAuthorityList"
:
{
"post"
:
{
"post"
:
{
"security"
:
[
"security"
:
[
...
@@ -344,6 +488,81 @@
...
@@ -344,6 +488,81 @@
}
}
}
}
},
},
"/fileUploadAndDownload/getFileList"
:
{
"post"
:
{
"security"
:
[
{
"ApiKeyAuth"
:
[]
}
],
"consumes"
:
[
"application/json"
],
"produces"
:
[
"application/json"
],
"tags"
:
[
"FileUploadAndDownload"
],
"summary"
:
"分页文件列表"
,
"parameters"
:
[
{
"description"
:
"分页获取文件户列表"
,
"name"
:
"data"
,
"in"
:
"body"
,
"required"
:
true
,
"schema"
:
{
"type"
:
"object"
,
"$ref"
:
"#/definitions/modelInterface.PageInfo"
}
}
],
"responses"
:
{
"200"
:
{
"description"
:
"{
\"
success
\"
:true,
\"
data
\"
:{},
\"
msg
\"
:
\"
获取成功
\"
}"
,
"schema"
:
{
"type"
:
"string"
}
}
}
}
},
"/fileUploadAndDownload/upload"
:
{
"post"
:
{
"security"
:
[
{
"ApiKeyAuth"
:
[]
}
],
"consumes"
:
[
"multipart/form-data"
],
"produces"
:
[
"application/json"
],
"tags"
:
[
"FileUploadAndDownload"
],
"summary"
:
"上传文件示例"
,
"parameters"
:
[
{
"type"
:
"file"
,
"description"
:
"上传文件示例"
,
"name"
:
"file"
,
"in"
:
"formData"
,
"required"
:
true
}
],
"responses"
:
{
"200"
:
{
"description"
:
"{
\"
success
\"
:true,
\"
data
\"
:{},
\"
msg
\"
:
\"
上传成功
\"
}"
,
"schema"
:
{
"type"
:
"string"
}
}
}
}
},
"/menu/addBaseMenu"
:
{
"/menu/addBaseMenu"
:
{
"post"
:
{
"post"
:
{
"security"
:
[
"security"
:
[
...
@@ -360,16 +579,16 @@
...
@@ -360,16 +579,16 @@
"tags"
:
[
"tags"
:
[
"menu"
"menu"
],
],
"summary"
:
"
分页获取基础menu列表
"
,
"summary"
:
"
新增菜单
"
,
"parameters"
:
[
"parameters"
:
[
{
{
"description"
:
"
分页获取基础menu列表
"
,
"description"
:
"
新增菜单
"
,
"name"
:
"data"
,
"name"
:
"data"
,
"in"
:
"body"
,
"in"
:
"body"
,
"required"
:
true
,
"required"
:
true
,
"schema"
:
{
"schema"
:
{
"type"
:
"object"
,
"type"
:
"object"
,
"$ref"
:
"#/definitions/
modelInterface.PageInfo
"
"$ref"
:
"#/definitions/
dbModel.BaseMenu
"
}
}
}
}
],
],
...
@@ -438,7 +657,7 @@
...
@@ -438,7 +657,7 @@
"tags"
:
[
"tags"
:
[
"menu"
"menu"
],
],
"summary"
:
"
获取指定角色menu
"
,
"summary"
:
"
删除菜单
"
,
"parameters"
:
[
"parameters"
:
[
{
{
"description"
:
"删除菜单"
,
"description"
:
"删除菜单"
,
...
@@ -461,6 +680,45 @@
...
@@ -461,6 +680,45 @@
}
}
}
}
},
},
"/menu/getBaseMenuById"
:
{
"post"
:
{
"security"
:
[
{
"ApiKeyAuth"
:
[]
}
],
"consumes"
:
[
"application/json"
],
"produces"
:
[
"application/json"
],
"tags"
:
[
"menu"
],
"summary"
:
"根据id获取菜单"
,
"parameters"
:
[
{
"description"
:
"根据id获取菜单"
,
"name"
:
"data"
,
"in"
:
"body"
,
"required"
:
true
,
"schema"
:
{
"type"
:
"object"
,
"$ref"
:
"#/definitions/api.GetById"
}
}
],
"responses"
:
{
"200"
:
{
"description"
:
"{
\"
success
\"
:true,
\"
data
\"
:{},
\"
msg
\"
:
\"
获取成功
\"
}"
,
"schema"
:
{
"type"
:
"string"
}
}
}
}
},
"/menu/getBaseMenuTree"
:
{
"/menu/getBaseMenuTree"
:
{
"post"
:
{
"post"
:
{
"security"
:
[
"security"
:
[
...
@@ -572,6 +830,45 @@
...
@@ -572,6 +830,45 @@
}
}
}
}
},
},
"/menu/updataBaseMen"
:
{
"post"
:
{
"security"
:
[
{
"ApiKeyAuth"
:
[]
}
],
"consumes"
:
[
"application/json"
],
"produces"
:
[
"application/json"
],
"tags"
:
[
"menu"
],
"summary"
:
"更新菜单"
,
"parameters"
:
[
{
"description"
:
"更新菜单"
,
"name"
:
"data"
,
"in"
:
"body"
,
"required"
:
true
,
"schema"
:
{
"type"
:
"object"
,
"$ref"
:
"#/definitions/dbModel.BaseMenu"
}
}
],
"responses"
:
{
"200"
:
{
"description"
:
"{
\"
success
\"
:true,
\"
data
\"
:{},
\"
msg
\"
:
\"
获取成功
\"
}"
,
"schema"
:
{
"type"
:
"string"
}
}
}
}
},
"/user/changePassword"
:
{
"/user/changePassword"
:
{
"post"
:
{
"post"
:
{
"security"
:
[
"security"
:
[
...
@@ -608,7 +905,7 @@
...
@@ -608,7 +905,7 @@
}
}
}
}
},
},
"/user/get
Info
List"
:
{
"/user/get
User
List"
:
{
"post"
:
{
"post"
:
{
"security"
:
[
"security"
:
[
{
{
...
@@ -647,6 +944,45 @@
...
@@ -647,6 +944,45 @@
}
}
}
}
},
},
"/user/setUserAuthority"
:
{
"post"
:
{
"security"
:
[
{
"ApiKeyAuth"
:
[]
}
],
"consumes"
:
[
"application/json"
],
"produces"
:
[
"application/json"
],
"tags"
:
[
"User"
],
"summary"
:
"设置用户权限"
,
"parameters"
:
[
{
"description"
:
"设置用户权限"
,
"name"
:
"data"
,
"in"
:
"body"
,
"required"
:
true
,
"schema"
:
{
"type"
:
"object"
,
"$ref"
:
"#/definitions/api.SetUserAuth"
}
}
],
"responses"
:
{
"200"
:
{
"description"
:
"{
\"
success
\"
:true,
\"
data
\"
:{},
\"
msg
\"
:
\"
修改成功
\"
}"
,
"schema"
:
{
"type"
:
"string"
}
}
}
}
},
"/user/uploadHeaderImg"
:
{
"/user/uploadHeaderImg"
:
{
"post"
:
{
"post"
:
{
"security"
:
[
"security"
:
[
...
@@ -709,10 +1045,10 @@
...
@@ -709,10 +1045,10 @@
"api.AuthAndPathIn"
:
{
"api.AuthAndPathIn"
:
{
"type"
:
"object"
,
"type"
:
"object"
,
"properties"
:
{
"properties"
:
{
"apis"
:
{
"api
Id
s"
:
{
"type"
:
"array"
,
"type"
:
"array"
,
"items"
:
{
"items"
:
{
"
$ref"
:
"#/definitions/dbModel.Api
"
"
type"
:
"integer
"
}
}
},
},
"authorityId"
:
{
"authorityId"
:
{
...
@@ -764,19 +1100,27 @@
...
@@ -764,19 +1100,27 @@
}
}
}
}
},
},
"api.DeleteA
piPar
ams"
:
{
"api.DeleteA
uthorityPat
ams"
:
{
"type"
:
"object"
,
"type"
:
"object"
,
"properties"
:
{
"properties"
:
{
"
path
"
:
{
"
authorityId
"
:
{
"type"
:
"integer"
"type"
:
"integer"
}
}
}
}
},
},
"api.
DeleteAuthorityPatams
"
:
{
"api.
GetAuthorityId
"
:
{
"type"
:
"object"
,
"type"
:
"object"
,
"properties"
:
{
"properties"
:
{
"authorityId"
:
{
"authorityId"
:
{
"type"
:
"integer"
"type"
:
"string"
}
}
},
"api.GetById"
:
{
"type"
:
"object"
,
"properties"
:
{
"id"
:
{
"type"
:
"number"
}
}
}
}
},
},
...
@@ -799,12 +1143,26 @@
...
@@ -799,12 +1143,26 @@
}
}
}
}
},
},
"api.SetUserAuth"
:
{
"type"
:
"object"
,
"properties"
:
{
"authorityId"
:
{
"type"
:
"string"
},
"uuid"
:
{
"type"
:
"string"
}
}
},
"dbModel.Api"
:
{
"dbModel.Api"
:
{
"type"
:
"object"
,
"type"
:
"object"
,
"properties"
:
{
"properties"
:
{
"description"
:
{
"description"
:
{
"type"
:
"string"
"type"
:
"string"
},
},
"group"
:
{
"type"
:
"string"
},
"path"
:
{
"path"
:
{
"type"
:
"string"
"type"
:
"string"
}
}
...
...
QMPlusServer/docs/swagger.yaml
浏览文件 @
4ebd90e0
...
@@ -11,9 +11,9 @@ definitions:
...
@@ -11,9 +11,9 @@ definitions:
type
:
object
type
:
object
api.AuthAndPathIn
:
api.AuthAndPathIn
:
properties
:
properties
:
apis
:
api
Id
s
:
items
:
items
:
$ref
:
'
#/definitions/dbModel.Api'
type
:
integer
type
:
array
type
:
array
authorityId
:
authorityId
:
type
:
string
type
:
string
...
@@ -46,15 +46,20 @@ definitions:
...
@@ -46,15 +46,20 @@ definitions:
authorityName
:
authorityName
:
type
:
string
type
:
string
type
:
object
type
:
object
api.DeleteA
piPar
ams
:
api.DeleteA
uthorityPat
ams
:
properties
:
properties
:
path
:
authorityId
:
type
:
integer
type
:
integer
type
:
object
type
:
object
api.
DeleteAuthorityPatams
:
api.
GetAuthorityId
:
properties
:
properties
:
authorityId
:
authorityId
:
type
:
integer
type
:
string
type
:
object
api.GetById
:
properties
:
id
:
type
:
number
type
:
object
type
:
object
api.IdInfo
:
api.IdInfo
:
properties
:
properties
:
...
@@ -68,10 +73,19 @@ definitions:
...
@@ -68,10 +73,19 @@ definitions:
username
:
username
:
type
:
string
type
:
string
type
:
object
type
:
object
api.SetUserAuth
:
properties
:
authorityId
:
type
:
string
uuid
:
type
:
string
type
:
object
dbModel.Api
:
dbModel.Api
:
properties
:
properties
:
description
:
description
:
type
:
string
type
:
string
group
:
type
:
string
path
:
path
:
type
:
string
type
:
string
type
:
object
type
:
object
...
@@ -146,7 +160,7 @@ paths:
...
@@ -146,7 +160,7 @@ paths:
name
:
data
name
:
data
required
:
true
required
:
true
schema
:
schema
:
$ref
:
'
#/definitions/
api.DeleteApiParams
'
$ref
:
'
#/definitions/
dbModel.Api
'
type
:
object
type
:
object
produces
:
produces
:
-
application/json
-
application/json
...
@@ -160,7 +174,23 @@ paths:
...
@@ -160,7 +174,23 @@ paths:
summary
:
删除指定api
summary
:
删除指定api
tags
:
tags
:
-
Api
-
Api
/api/getApiList
:
/api/getAllApis
:
post
:
consumes
:
-
application/json
produces
:
-
application/json
responses
:
"
200"
:
description
:
'
{"success":true,"data":{},"msg":"获取成功"}'
schema
:
type
:
string
security
:
-
ApiKeyAuth
:
[]
summary
:
获取所有的Api 不分页
tags
:
-
Api
/api/getApiById
:
post
:
post
:
consumes
:
consumes
:
-
application/json
-
application/json
...
@@ -181,10 +211,34 @@ paths:
...
@@ -181,10 +211,34 @@ paths:
type
:
string
type
:
string
security
:
security
:
-
ApiKeyAuth
:
[]
-
ApiKeyAuth
:
[]
summary
:
分页获取角色列表
summary
:
根据id获取api
tags
:
tags
:
-
Api
-
Api
/api/setAuthAndPath
:
/api/getApiList
:
post
:
consumes
:
-
application/json
parameters
:
-
description
:
分页获取API列表
in
:
body
name
:
data
required
:
true
schema
:
$ref
:
'
#/definitions/modelInterface.PageInfo'
type
:
object
produces
:
-
application/json
responses
:
"
200"
:
description
:
'
{"success":true,"data":{},"msg":"获取成功"}'
schema
:
type
:
string
security
:
-
ApiKeyAuth
:
[]
summary
:
分页获取API列表
tags
:
-
Api
/api/setAuthAndApi
:
post
:
post
:
consumes
:
consumes
:
-
application/json
-
application/json
...
@@ -208,6 +262,30 @@ paths:
...
@@ -208,6 +262,30 @@ paths:
summary
:
创建api和角色关系
summary
:
创建api和角色关系
tags
:
tags
:
-
Api
-
Api
/api/updataApi
:
post
:
consumes
:
-
application/json
parameters
:
-
description
:
创建api
in
:
body
name
:
data
required
:
true
schema
:
$ref
:
'
#/definitions/api.CreateApiParams'
type
:
object
produces
:
-
application/json
responses
:
"
200"
:
description
:
'
{"success":true,"data":{},"msg":"获取成功"}'
schema
:
type
:
string
security
:
-
ApiKeyAuth
:
[]
summary
:
创建基础api
tags
:
-
Api
/authority/createAuthority
:
/authority/createAuthority
:
post
:
post
:
consumes
:
consumes
:
...
@@ -256,6 +334,30 @@ paths:
...
@@ -256,6 +334,30 @@ paths:
summary
:
删除角色
summary
:
删除角色
tags
:
tags
:
-
authority
-
authority
/authority/getAuthAndApi
:
post
:
consumes
:
-
application/json
parameters
:
-
description
:
获取本角色所有有权限的apiId
in
:
body
name
:
data
required
:
true
schema
:
$ref
:
'
#/definitions/api.GetAuthorityId'
type
:
object
produces
:
-
application/json
responses
:
"
200"
:
description
:
'
{"success":true,"data":{},"msg":"获取成功"}'
schema
:
type
:
string
security
:
-
ApiKeyAuth
:
[]
summary
:
获取本角色所有有权限的apiId
tags
:
-
authority
/authority/getAuthorityList
:
/authority/getAuthorityList
:
post
:
post
:
consumes
:
consumes
:
...
@@ -320,12 +422,12 @@ paths:
...
@@ -320,12 +422,12 @@ paths:
summary
:
用户注册账号
summary
:
用户注册账号
tags
:
tags
:
-
Base
-
Base
/
menu/addBaseMenu
:
/
fileUploadAndDownload/getFileList
:
post
:
post
:
consumes
:
consumes
:
-
application/json
-
application/json
parameters
:
parameters
:
-
description
:
分页获取
基础menu
列表
-
description
:
分页获取
文件户
列表
in
:
body
in
:
body
name
:
data
name
:
data
required
:
true
required
:
true
...
@@ -341,7 +443,53 @@ paths:
...
@@ -341,7 +443,53 @@ paths:
type
:
string
type
:
string
security
:
security
:
-
ApiKeyAuth
:
[]
-
ApiKeyAuth
:
[]
summary
:
分页获取基础menu列表
summary
:
分页文件列表
tags
:
-
FileUploadAndDownload
/fileUploadAndDownload/upload
:
post
:
consumes
:
-
multipart/form-data
parameters
:
-
description
:
上传文件示例
in
:
formData
name
:
file
required
:
true
type
:
file
produces
:
-
application/json
responses
:
"
200"
:
description
:
'
{"success":true,"data":{},"msg":"上传成功"}'
schema
:
type
:
string
security
:
-
ApiKeyAuth
:
[]
summary
:
上传文件示例
tags
:
-
FileUploadAndDownload
/menu/addBaseMenu
:
post
:
consumes
:
-
application/json
parameters
:
-
description
:
新增菜单
in
:
body
name
:
data
required
:
true
schema
:
$ref
:
'
#/definitions/dbModel.BaseMenu'
type
:
object
produces
:
-
application/json
responses
:
"
200"
:
description
:
'
{"success":true,"data":{},"msg":"获取成功"}'
schema
:
type
:
string
security
:
-
ApiKeyAuth
:
[]
summary
:
新增菜单
tags
:
tags
:
-
menu
-
menu
/menu/addMenuAuthority
:
/menu/addMenuAuthority
:
...
@@ -389,7 +537,31 @@ paths:
...
@@ -389,7 +537,31 @@ paths:
type
:
string
type
:
string
security
:
security
:
-
ApiKeyAuth
:
[]
-
ApiKeyAuth
:
[]
summary
:
获取指定角色menu
summary
:
删除菜单
tags
:
-
menu
/menu/getBaseMenuById
:
post
:
consumes
:
-
application/json
parameters
:
-
description
:
根据id获取菜单
in
:
body
name
:
data
required
:
true
schema
:
$ref
:
'
#/definitions/api.GetById'
type
:
object
produces
:
-
application/json
responses
:
"
200"
:
description
:
'
{"success":true,"data":{},"msg":"获取成功"}'
schema
:
type
:
string
security
:
-
ApiKeyAuth
:
[]
summary
:
根据id获取菜单
tags
:
tags
:
-
menu
-
menu
/menu/getBaseMenuTree
:
/menu/getBaseMenuTree
:
...
@@ -460,6 +632,30 @@ paths:
...
@@ -460,6 +632,30 @@ paths:
summary
:
分页获取基础menu列表
summary
:
分页获取基础menu列表
tags
:
tags
:
-
menu
-
menu
/menu/updataBaseMen
:
post
:
consumes
:
-
application/json
parameters
:
-
description
:
更新菜单
in
:
body
name
:
data
required
:
true
schema
:
$ref
:
'
#/definitions/dbModel.BaseMenu'
type
:
object
produces
:
-
application/json
responses
:
"
200"
:
description
:
'
{"success":true,"data":{},"msg":"获取成功"}'
schema
:
type
:
string
security
:
-
ApiKeyAuth
:
[]
summary
:
更新菜单
tags
:
-
menu
/user/changePassword
:
/user/changePassword
:
post
:
post
:
parameters
:
parameters
:
...
@@ -482,7 +678,7 @@ paths:
...
@@ -482,7 +678,7 @@ paths:
summary
:
用户修改密码
summary
:
用户修改密码
tags
:
tags
:
-
User
-
User
/user/get
Info
List
:
/user/get
User
List
:
post
:
post
:
consumes
:
consumes
:
-
application/json
-
application/json
...
@@ -506,6 +702,30 @@ paths:
...
@@ -506,6 +702,30 @@ paths:
summary
:
分页获取用户列表
summary
:
分页获取用户列表
tags
:
tags
:
-
User
-
User
/user/setUserAuthority
:
post
:
consumes
:
-
application/json
parameters
:
-
description
:
设置用户权限
in
:
body
name
:
data
required
:
true
schema
:
$ref
:
'
#/definitions/api.SetUserAuth'
type
:
object
produces
:
-
application/json
responses
:
"
200"
:
description
:
'
{"success":true,"data":{},"msg":"修改成功"}'
schema
:
type
:
string
security
:
-
ApiKeyAuth
:
[]
summary
:
设置用户权限
tags
:
-
User
/user/uploadHeaderImg
:
/user/uploadHeaderImg
:
post
:
post
:
consumes
:
consumes
:
...
...
QMPlusServer/go.mod
浏览文件 @
4ebd90e0
...
@@ -18,6 +18,8 @@ require (
...
@@ -18,6 +18,8 @@ require (
github.com/qiniu/x v7.0.8+incompatible // indirect
github.com/qiniu/x v7.0.8+incompatible // indirect
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5
github.com/satori/go.uuid v1.2.0
github.com/satori/go.uuid v1.2.0
github.com/shamsher31/goimgext v1.0.0 // indirect
github.com/shamsher31/goimgtype v1.0.0
github.com/sirupsen/logrus v1.2.0
github.com/sirupsen/logrus v1.2.0
github.com/spf13/viper v1.4.0
github.com/spf13/viper v1.4.0
github.com/swaggo/gin-swagger v1.2.0
github.com/swaggo/gin-swagger v1.2.0
...
...
QMPlusServer/init/initRouter/initRouter.go
浏览文件 @
4ebd90e0
...
@@ -13,11 +13,11 @@ func InitRouter() *gin.Engine {
...
@@ -13,11 +13,11 @@ func InitRouter() *gin.Engine {
var
Router
=
gin
.
Default
()
var
Router
=
gin
.
Default
()
Router
.
GET
(
"/swagger/*any"
,
ginSwagger
.
WrapHandler
(
swaggerFiles
.
Handler
))
Router
.
GET
(
"/swagger/*any"
,
ginSwagger
.
WrapHandler
(
swaggerFiles
.
Handler
))
//Router.Use(middleware.Logger())
//Router.Use(middleware.Logger())
router
.
InitUserRouter
(
Router
)
// 注册用户路由
router
.
InitUserRouter
(
Router
)
// 注册用户路由
router
.
InitBaseRouter
(
Router
)
// 注册基础功能路由
router
.
InitBaseRouter
(
Router
)
// 注册基础功能路由
router
.
InitMenuRouter
(
Router
)
// 注册menu路由
router
.
InitMenuRouter
(
Router
)
// 注册menu路由
router
.
InitAuthorityRouter
(
Router
)
// 注册角色路由
router
.
InitAuthorityRouter
(
Router
)
// 注册角色路由
router
.
InitApiRouter
(
Router
)
// 注册功能api路由
router
.
InitApiRouter
(
Router
)
// 注册功能api路由
router
.
InitFileUploadAndDownloadRouter
(
Router
)
// 文件上传下载功能路由
return
Router
return
Router
}
}
QMPlusServer/init/registTable/registTable.go
浏览文件 @
4ebd90e0
...
@@ -7,5 +7,5 @@ import (
...
@@ -7,5 +7,5 @@ import (
//注册数据库表专用
//注册数据库表专用
func
RegistTable
(
db
*
gorm
.
DB
)
{
func
RegistTable
(
db
*
gorm
.
DB
)
{
db
.
AutoMigrate
(
dbModel
.
User
{},
dbModel
.
Authority
{},
dbModel
.
Menu
{},
dbModel
.
Api
{},
dbModel
.
ApiAuthority
{},
dbModel
.
BaseMenu
{})
db
.
AutoMigrate
(
dbModel
.
User
{},
dbModel
.
Authority
{},
dbModel
.
Menu
{},
dbModel
.
Api
{},
dbModel
.
ApiAuthority
{},
dbModel
.
BaseMenu
{}
,
dbModel
.
FileUploadAndDownload
{}
)
}
}
QMPlusServer/model/dbModel/fileUploadAndDown.go
已删除
100644 → 0
浏览文件 @
dd209669
package
dbModel
QMPlusServer/model/dbModel/fileUploadAndDownload.go
0 → 100644
浏览文件 @
4ebd90e0
package
dbModel
import
(
"github.com/jinzhu/gorm"
"main/controller/servers"
"main/init/qmsql"
"main/model/modelInterface"
)
type
FileUploadAndDownload
struct
{
gorm
.
Model
Name
string
`json:"name"`
Url
string
`json:"url"`
Tag
string
`json:"tag"`
}
func
(
f
*
FileUploadAndDownload
)
Upload
()
error
{
err
:=
qmsql
.
DEFAULTDB
.
Create
(
f
)
.
Error
return
err
}
// 分页获取数据 需要分页实现这个接口即可
func
(
f
*
FileUploadAndDownload
)
GetInfoList
(
info
modelInterface
.
PageInfo
)
(
err
error
,
list
interface
{},
total
int
)
{
// 封装分页方法 调用即可 传入 当前的结构体和分页信息
err
,
db
,
total
:=
servers
.
PagingServer
(
f
,
info
)
if
err
!=
nil
{
return
}
else
{
var
fileLists
[]
FileUploadAndDownload
err
=
db
.
Order
(
"updated_at desc"
)
.
Find
(
&
fileLists
)
.
Error
return
err
,
fileLists
,
total
}
}
QMPlusServer/router/fileUploadAndDownload.go
0 → 100644
浏览文件 @
4ebd90e0
package
router
import
(
"github.com/gin-gonic/gin"
"main/controller/api"
"main/middleware"
)
func
InitFileUploadAndDownloadRouter
(
Router
*
gin
.
Engine
)
{
FileUploadAndDownloadGroup
:=
Router
.
Group
(
"fileUploadAndDownload"
)
.
Use
(
middleware
.
JWTAuth
())
{
FileUploadAndDownloadGroup
.
POST
(
"/upload"
,
api
.
UploadFile
)
// 上传文件
FileUploadAndDownloadGroup
.
POST
(
"/getFileList"
,
api
.
GetFileList
)
// 获取上传文件列表
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录