Browse Source

Merge pull request #626 from flipped-aurora/gva_gormv2_dev

Gva gormv2 dev
main
奇淼(piexlmax 3 years ago
committed by GitHub
parent
commit
782fc0df93
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      server/api/v1/system/sys_menu.go
  2. 1
      server/config.yaml
  3. 2
      server/config/oss.go
  4. 74
      server/docs/docs.go
  5. 74
      server/docs/swagger.json
  6. 52
      server/docs/swagger.yaml
  7. 2
      server/model/common/request/common.go
  8. 4
      server/model/system/request/sys_menu.go
  9. 2
      server/model/system/sys_system.go
  10. 2
      server/utils/upload/qiniu.go

2
server/api/v1/system/sys_menu.go

@ -81,7 +81,7 @@ func (a *AuthorityMenuApi) AddMenuAuthority(c *gin.Context) {
// @Produce application/json
// @Param data body request.GetAuthorityId true "角色ID"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /menu/GetMenuAuthority [post]
// @Router /menu/getMenuAuthority [post]
func (a *AuthorityMenuApi) GetMenuAuthority(c *gin.Context) {
var param request.GetAuthorityId
_ = c.ShouldBindJSON(&param)

1
server/config.yaml

@ -132,3 +132,4 @@ Timer:
{ tableName: "sys_operation_records" , compareField: "created_at", interval: "2160h" },
#{ tableName: "log2" , compareField: "created_at", interval: "2160h" }
]

2
server/config/oss.go

@ -20,7 +20,7 @@ type AliyunOSS struct {
AccessKeySecret string `mapstructure:"access-key-secret" json:"accessKeySecret" yaml:"access-key-secret"`
BucketName string `mapstructure:"bucket-name" json:"bucketName" yaml:"bucket-name"`
BucketUrl string `mapstructure:"bucket-url" json:"bucketUrl" yaml:"bucket-url"`
BasePath string `mapstructure:"base-path" json:"basePath" yaml:"base-path"`
BasePath string `mapstructure:"base-path" json:"basePath" yaml:"base-path"`
}
type TencentCOS struct {
Bucket string `mapstructure:"bucket" json:"bucket" yaml:"bucket"`

74
server/docs/docs.go

@ -1554,7 +1554,9 @@ var doc = `{
}
],
"responses": {
"200": {}
"200": {
"description": ""
}
}
}
},
@ -1587,7 +1589,9 @@ var doc = `{
}
],
"responses": {
"200": {}
"200": {
"description": ""
}
}
}
},
@ -1944,7 +1948,7 @@ var doc = `{
}
}
},
"/menu/GetMenuAuthority": {
"/menu/addBaseMenu": {
"post": {
"security": [
{
@ -1958,23 +1962,23 @@ var doc = `{
"application/json"
],
"tags": [
"AuthorityMenu"
"Menu"
],
"summary": "获取指定角色menu",
"summary": "新增菜单",
"parameters": [
{
"description": "角色ID",
"description": "路由path, 父菜单ID, 路由name, 对应前端文件路径, 排序标记",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.GetAuthorityId"
"$ref": "#/definitions/system.SysBaseMenu"
}
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}",
"description": "{\"success\":true,\"data\":{},\"msg\":\"添加成功\"}",
"schema": {
"type": "string"
}
@ -1982,7 +1986,7 @@ var doc = `{
}
}
},
"/menu/addBaseMenu": {
"/menu/addMenuAuthority": {
"post": {
"security": [
{
@ -1996,17 +2000,17 @@ var doc = `{
"application/json"
],
"tags": [
"Menu"
"AuthorityMenu"
],
"summary": "新增菜单",
"summary": "增加menu和角色关联关系",
"parameters": [
{
"description": "路由path, 父菜单ID, 路由name, 对应前端文件路径, 排序标记",
"description": "角色ID",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/system.SysBaseMenu"
"$ref": "#/definitions/request.AddMenuAuthorityInfo"
}
}
],
@ -2020,7 +2024,7 @@ var doc = `{
}
}
},
"/menu/addMenuAuthority": {
"/menu/deleteBaseMenu": {
"post": {
"security": [
{
@ -2034,23 +2038,23 @@ var doc = `{
"application/json"
],
"tags": [
"AuthorityMenu"
"Menu"
],
"summary": "增加menu和角色关联关系",
"summary": "删除菜单",
"parameters": [
{
"description": "角色ID",
"description": "菜单id",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.AddMenuAuthorityInfo"
"$ref": "#/definitions/request.GetById"
}
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"添加成功\"}",
"description": "{\"success\":true,\"data\":{},\"msg\":\"删除成功\"}",
"schema": {
"type": "string"
}
@ -2058,7 +2062,7 @@ var doc = `{
}
}
},
"/menu/deleteBaseMenu": {
"/menu/getBaseMenuById": {
"post": {
"security": [
{
@ -2074,7 +2078,7 @@ var doc = `{
"tags": [
"Menu"
],
"summary": "删除菜单",
"summary": "根据id获取菜单",
"parameters": [
{
"description": "菜单id",
@ -2088,7 +2092,7 @@ var doc = `{
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"删除成功\"}",
"description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}",
"schema": {
"type": "string"
}
@ -2096,31 +2100,28 @@ var doc = `{
}
}
},
"/menu/getBaseMenuById": {
"/menu/getBaseMenuTree": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Menu"
"AuthorityMenu"
],
"summary": "根据id获取菜单",
"summary": "获取用户动态路由",
"parameters": [
{
"description": "菜单id",
"description": "",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.GetById"
"$ref": "#/definitions/request.Empty"
}
}
],
@ -2134,7 +2135,7 @@ var doc = `{
}
}
},
"/menu/getBaseMenuTree": {
"/menu/getMenu": {
"post": {
"security": [
{
@ -2169,28 +2170,31 @@ var doc = `{
}
}
},
"/menu/getMenu": {
"/menu/getMenuAuthority": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"AuthorityMenu"
],
"summary": "获取用户动态路由",
"summary": "获取指定角色menu",
"parameters": [
{
"description": "",
"description": "角色ID",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.Empty"
"$ref": "#/definitions/request.GetAuthorityId"
}
}
],

74
server/docs/swagger.json

@ -1538,7 +1538,9 @@
}
],
"responses": {
"200": {}
"200": {
"description": ""
}
}
}
},
@ -1571,7 +1573,9 @@
}
],
"responses": {
"200": {}
"200": {
"description": ""
}
}
}
},
@ -1928,7 +1932,7 @@
}
}
},
"/menu/GetMenuAuthority": {
"/menu/addBaseMenu": {
"post": {
"security": [
{
@ -1942,23 +1946,23 @@
"application/json"
],
"tags": [
"AuthorityMenu"
"Menu"
],
"summary": "获取指定角色menu",
"summary": "新增菜单",
"parameters": [
{
"description": "角色ID",
"description": "路由path, 父菜单ID, 路由name, 对应前端文件路径, 排序标记",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.GetAuthorityId"
"$ref": "#/definitions/system.SysBaseMenu"
}
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}",
"description": "{\"success\":true,\"data\":{},\"msg\":\"添加成功\"}",
"schema": {
"type": "string"
}
@ -1966,7 +1970,7 @@
}
}
},
"/menu/addBaseMenu": {
"/menu/addMenuAuthority": {
"post": {
"security": [
{
@ -1980,17 +1984,17 @@
"application/json"
],
"tags": [
"Menu"
"AuthorityMenu"
],
"summary": "新增菜单",
"summary": "增加menu和角色关联关系",
"parameters": [
{
"description": "路由path, 父菜单ID, 路由name, 对应前端文件路径, 排序标记",
"description": "角色ID",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/system.SysBaseMenu"
"$ref": "#/definitions/request.AddMenuAuthorityInfo"
}
}
],
@ -2004,7 +2008,7 @@
}
}
},
"/menu/addMenuAuthority": {
"/menu/deleteBaseMenu": {
"post": {
"security": [
{
@ -2018,23 +2022,23 @@
"application/json"
],
"tags": [
"AuthorityMenu"
"Menu"
],
"summary": "增加menu和角色关联关系",
"summary": "删除菜单",
"parameters": [
{
"description": "角色ID",
"description": "菜单id",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.AddMenuAuthorityInfo"
"$ref": "#/definitions/request.GetById"
}
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"添加成功\"}",
"description": "{\"success\":true,\"data\":{},\"msg\":\"删除成功\"}",
"schema": {
"type": "string"
}
@ -2042,7 +2046,7 @@
}
}
},
"/menu/deleteBaseMenu": {
"/menu/getBaseMenuById": {
"post": {
"security": [
{
@ -2058,7 +2062,7 @@
"tags": [
"Menu"
],
"summary": "删除菜单",
"summary": "根据id获取菜单",
"parameters": [
{
"description": "菜单id",
@ -2072,7 +2076,7 @@
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"删除成功\"}",
"description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}",
"schema": {
"type": "string"
}
@ -2080,31 +2084,28 @@
}
}
},
"/menu/getBaseMenuById": {
"/menu/getBaseMenuTree": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Menu"
"AuthorityMenu"
],
"summary": "根据id获取菜单",
"summary": "获取用户动态路由",
"parameters": [
{
"description": "菜单id",
"description": "",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.GetById"
"$ref": "#/definitions/request.Empty"
}
}
],
@ -2118,7 +2119,7 @@
}
}
},
"/menu/getBaseMenuTree": {
"/menu/getMenu": {
"post": {
"security": [
{
@ -2153,28 +2154,31 @@
}
}
},
"/menu/getMenu": {
"/menu/getMenuAuthority": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"AuthorityMenu"
],
"summary": "获取用户动态路由",
"summary": "获取指定角色menu",
"parameters": [
{
"description": "",
"description": "角色ID",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.Empty"
"$ref": "#/definitions/request.GetAuthorityId"
}
}
],

52
server/docs/swagger.yaml

@ -1857,7 +1857,8 @@ paths:
produces:
- application/json
responses:
"200": {}
"200":
description: ""
security:
- ApiKeyAuth: []
summary: 下载模板
@ -1877,7 +1878,8 @@ paths:
produces:
- application/octet-stream
responses:
"200": {}
"200":
description: ""
security:
- ApiKeyAuth: []
summary: 导出Excel
@ -2098,29 +2100,6 @@ paths:
summary: jwt加入黑名单
tags:
- Jwt
/menu/GetMenuAuthority:
post:
consumes:
- application/json
parameters:
- description: 角色ID
in: body
name: data
required: true
schema:
$ref: '#/definitions/request.GetAuthorityId'
produces:
- application/json
responses:
"200":
description: '{"success":true,"data":{},"msg":"获取成功"}'
schema:
type: string
security:
- ApiKeyAuth: []
summary: 获取指定角色menu
tags:
- AuthorityMenu
/menu/addBaseMenu:
post:
consumes:
@ -2255,6 +2234,29 @@ paths:
summary: 获取用户动态路由
tags:
- AuthorityMenu
/menu/getMenuAuthority:
post:
consumes:
- application/json
parameters:
- description: 角色ID
in: body
name: data
required: true
schema:
$ref: '#/definitions/request.GetAuthorityId'
produces:
- application/json
responses:
"200":
description: '{"success":true,"data":{},"msg":"获取成功"}'
schema:
type: string
security:
- ApiKeyAuth: []
summary: 获取指定角色menu
tags:
- AuthorityMenu
/menu/getMenuList:
post:
consumes:

2
server/model/common/request/common.go

@ -17,7 +17,7 @@ type IdsReq struct {
// Get role by id structure
type GetAuthorityId struct {
AuthorityId string // 角色ID
AuthorityId string `json:"authorityId" form:"authorityId"` // 角色ID
}
type Empty struct{}

4
server/model/system/request/sys_menu.go

@ -7,8 +7,8 @@ import (
// Add menu authority info structure
type AddMenuAuthorityInfo struct {
Menus []system.SysBaseMenu
AuthorityId string // 角色ID
Menus []system.SysBaseMenu `json:"menus"`
AuthorityId string `json:"authorityId"` // 角色ID
}
func DefaultMenu() []system.SysBaseMenu {

2
server/model/system/sys_system.go

@ -6,5 +6,5 @@ import (
// 配置文件结构体
type System struct {
Config config.Server
Config config.Server `json:"config"`
}

2
server/utils/upload/qiniu.go

@ -38,7 +38,7 @@ func (*Qiniu) UploadFile(file *multipart.FileHeader) (string, string, error) {
return "", "", errors.New("function file.Open() Filed, err:" + openError.Error())
}
defer f.Close() // 创建文件 defer 关闭
defer f.Close() // 创建文件 defer 关闭
fileKey := fmt.Sprintf("%d%s", time.Now().Unix(), file.Filename) // 文件名格式 自己可以改 建议保证唯一性
putErr := formUploader.Put(context.Background(), &ret, upToken, fileKey, f, file.Size, &putExtra)
if putErr != nil {

Loading…
Cancel
Save