From 87f86daca10284ecb18da068ab2c8a6559ad9984 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=92=8B=E5=90=89=E5=85=86?= <303176530@qq.com> Date: Mon, 16 Aug 2021 22:44:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=E9=81=97=E6=BC=8F=E7=9A=84js?= =?UTF-8?q?on=20type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/config.yaml | 194 ++++++++++-------------- server/docs/docs.go | 74 ++++----- server/docs/swagger.json | 74 ++++----- server/docs/swagger.yaml | 52 ++++--- server/model/system/request/sys_menu.go | 4 +- server/model/system/sys_system.go | 2 +- 6 files changed, 186 insertions(+), 214 deletions(-) diff --git a/server/config.yaml b/server/config.yaml index fa0c233d..98ec0dc1 100644 --- a/server/config.yaml +++ b/server/config.yaml @@ -1,78 +1,13 @@ -# Gin-Vue-Admin Global Configuration - -# jwt configuration -jwt: - signing-key: 'qmPlus' - expires-time: 604800 - buffer-time: 86400 - -# zap logger configuration -zap: - level: 'info' - format: 'console' - prefix: '[GIN-VUE-ADMIN]' - director: 'log' - link-name: 'latest_log' - show-line: true - encode-level: 'LowercaseColorLevelEncoder' - stacktrace-key: 'stacktrace' - log-in-console: true - -# redis configuration -redis: - db: 0 - addr: '127.0.0.1:6379' - password: '' - -# email configuration -email: - to: 'xxx@qq.com' - port: 465 - from: 'xxx@163.com' - host: 'smtp.163.com' - is-ssl: true - secret: 'xxx' - nickname: 'test' - -# casbin configuration -casbin: - model-path: './resource/rbac_model.conf' - -# system configuration -system: - env: 'public' # Change to "develop" to skip authentication for development mode - addr: 8888 - db-type: 'mysql' - oss-type: 'local' # 控制oss选择走本期还是 七牛等其他仓 自行增加其他oss仓可以在 server/utils/upload/upload.go 中 NewOss函数配置 - use-multipoint: false - -# captcha configuration -captcha: - key-long: 6 - img-width: 240 - img-height: 80 - -# mysql connect configuration -# 未初始化之前请勿手动修改数据库信息!!!如果一定要手动初始化请看(https://www.gin-vue-admin.com/docs/first) -mysql: - path: '' - config: '' - db-name: '' - username: '' - password: '' - max-idle-conns: 10 - max-open-conns: 100 - log-mode: false - log-zap: "" - -# local configuration -local: - path: 'uploads/file' - -# autocode configuration +aliyun-oss: + endpoint: yourEndpoint + access-key-id: yourAccessKeyId + access-key-secret: yourAccessKeySecret + bucket-name: yourBucketName + bucket-url: yourBucketUrl + base-path: yourBasePath autocode: transfer-restart: true - root: "" + root: E:\gin-vue-admin server: /server server-api: /api/v1/autocode server-initialize: /initialize @@ -82,53 +17,80 @@ autocode: server-service: /service/autocode web: /web/src web-api: /api - web-flow: /view web-form: /view web-table: /view - -# qiniu configuration (请自行七牛申请对应的 公钥 私钥 bucket 和 域名地址) + web-flow: /view +captcha: + key-long: 6 + img-width: 240 + img-height: 80 +casbin: + model-path: ./resource/rbac_model.conf +email: + to: xxx@qq.com + port: 465 + from: xxx@163.com + host: smtp.163.com + is-ssl: true + secret: xxx + nickname: test +excel: + dir: ./resource/excel/ +jwt: + signing-key: qmPlus + expires-time: 604800 + buffer-time: 86400 +local: + path: uploads/file +mysql: + path: 127.0.0.1:3306 + config: charset=utf8mb4&parseTime=True&loc=Local + db-name: gva + username: root + password: Aa@6447985 + max-idle-conns: 0 + max-open-conns: 0 + log-mode: "" + log-zap: false qiniu: - zone: 'ZoneHuaDong' - bucket: '' - img-path: '' + zone: ZoneHuaDong + bucket: "" + img-path: "" use-https: false - access-key: '' - secret-key: '' + access-key: "" + secret-key: "" use-cdn-domains: false - - -# aliyun oss configuration -aliyun-oss: - endpoint: 'yourEndpoint' - access-key-id: 'yourAccessKeyId' - access-key-secret: 'yourAccessKeySecret' - bucket-name: 'yourBucketName' - bucket-url: 'yourBucketUrl' - base-path: 'yourBasePath' - -# tencent cos configuration +redis: + db: 0 + addr: 127.0.0.1:6379 + password: "" +system: + env: public + addr: 8888 + db-type: mysql + oss-type: local + use-multipoint: false tencent-cos: - bucket: 'xxxxx-10005608' - region: 'ap-shanghai' - secret-id: 'xxxxxxxx' - secret-key: 'xxxxxxxx' - base-url: 'https://gin.vue.admin' - path-prefix: 'gin-vue-admin' - -# excel configuration -excel: - dir: './resource/excel/' - - -# timer task db clear table -Timer: + bucket: xxxxx-10005608 + region: ap-shanghai + secret-id: xxxxxxxx + secret-key: xxxxxxxx + base-url: https://gin.vue.admin + path-prefix: gin-vue-admin +timer: start: true - spec: "@daily" # 定时任务详细配置参考 https://pkg.go.dev/github.com/robfig/cron/v3 - detail: [ - # tableName: 需要清理的表名 - # compareField: 需要比较时间的字段 - # interval: 时间间隔, 具体配置详看 time.ParseDuration() 中字符串表示 且不能为负数 - # 2160h = 24 * 30 * 3 -> 三个月 - { tableName: "sys_operation_records" , compareField: "created_at", interval: "2160h" }, - #{ tableName: "log2" , compareField: "created_at", interval: "2160h" } - ] + spec: '@daily' + detail: + - tableName: sys_operation_records + compareField: created_at + interval: 2160h +zap: + level: info + format: console + prefix: '[GIN-VUE-ADMIN]' + director: log + link-name: latest_log + showLine: true + encode-level: LowercaseColorLevelEncoder + stacktrace-key: stacktrace + log-in-console: true diff --git a/server/docs/docs.go b/server/docs/docs.go index 851b7f2d..28c80d96 100644 --- a/server/docs/docs.go +++ b/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" } } ], diff --git a/server/docs/swagger.json b/server/docs/swagger.json index b48dbd9a..ed0e1e2b 100644 --- a/server/docs/swagger.json +++ b/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" } } ], diff --git a/server/docs/swagger.yaml b/server/docs/swagger.yaml index af6f70c2..acdd8708 100644 --- a/server/docs/swagger.yaml +++ b/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: diff --git a/server/model/system/request/sys_menu.go b/server/model/system/request/sys_menu.go index c19ee6ae..e288e323 100644 --- a/server/model/system/request/sys_menu.go +++ b/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 { diff --git a/server/model/system/sys_system.go b/server/model/system/sys_system.go index 8ea71140..85df9968 100644 --- a/server/model/system/sys_system.go +++ b/server/model/system/sys_system.go @@ -6,5 +6,5 @@ import ( // 配置文件结构体 type System struct { - Config config.Server + Config config.Server `json:"config"` }