Prechádzať zdrojové kódy

Merge branch 'gin-vue-admin_v2_dev' of https://github.com/piexlmax/gin-vue-admin into gin-vue-admin_v2_dev

# Conflicts:
#	README.md
sun_song_1203 5 rokov pred
rodič
commit
6690736f9d
66 zmenil súbory, kde vykonal 858 pridanie a 732 odobranie
  1. 22 23
      README.md
  2. 0 29
      docker-compose.yml
  3. 5 5
      server/api/v1/exa_breakpoint_continue.go
  4. 0 9
      server/api/v1/sys_api.go
  5. 0 1
      server/api/v1/sys_captcha.go
  6. 3 3
      server/api/v1/sys_casbin.go
  7. 25 22
      server/api/v1/sys_menu.go
  8. 4 20
      server/api/v1/sys_user.go
  9. 0 43
      server/config.json
  10. 50 0
      server/config.yaml
  11. 60 0
      server/config/config.go
  12. 31 0
      server/core/config.go
  13. 21 58
      server/core/log.go
  14. 5 5
      server/core/server.go
  15. 3 3
      server/db/casbin_rule.sql
  16. 85 49
      server/db/qmplus.sql
  17. 1 1
      server/db/sys_apis.sql
  18. 5 5
      server/docs/docs.go
  19. 5 5
      server/docs/swagger.json
  20. 5 5
      server/docs/swagger.yaml
  21. 4 3
      server/global/global.go
  22. 5 5
      server/global/response/response.go
  23. 0 103
      server/init/config.go
  24. 0 17
      server/init/log.go
  25. 0 21
      server/init/redis.go
  26. 5 5
      server/initialize/db_table.go
  27. 4 3
      server/initialize/mysql.go
  28. 22 0
      server/initialize/redis.go
  29. 7 8
      server/initialize/router.go
  30. 3 27
      server/main.go
  31. 0 64
      server/middleware/logger.go
  32. 31 6
      server/model/exa_breakpoint_continue.go
  33. 22 6
      server/model/exa_customer.go
  34. 19 1
      server/model/exa_file_upload_download.go
  35. 43 8
      server/model/sys_api.go
  36. 51 3
      server/model/sys_authority.go
  37. 38 28
      server/model/sys_authority_menu.go
  38. 9 1
      server/model/sys_auto_code.go
  39. 36 10
      server/model/sys_base_menu.go
  40. 52 17
      server/model/sys_casbin.go
  41. 6 0
      server/model/sys_common.go
  42. 19 3
      server/model/sys_jwt_blacklist.go
  43. 12 5
      server/model/sys_system.go
  44. 52 11
      server/model/sys_user.go
  45. 4 1
      server/model/sys_workflow.go
  46. 8 7
      server/resource/template/te/model.go.tpl
  47. 1 1
      server/router/sys_casbin.go
  48. 3 3
      web/src/api/casbin.js
  49. 3 2
      web/src/store/module/user.js
  50. 7 7
      web/src/utils/request.js
  51. 1 1
      web/src/view/example/breakpoint/breakpoint.vue
  52. 3 3
      web/src/view/example/customer/customer.vue
  53. 2 2
      web/src/view/example/upload/upload.vue
  54. 21 8
      web/src/view/layout/aside/historyComponent/history.vue
  55. 1 1
      web/src/view/layout/index.vue
  56. 1 1
      web/src/view/login/register.vue
  57. 4 9
      web/src/view/superAdmin/api/api.vue
  58. 3 5
      web/src/view/superAdmin/authority/authority.vue
  59. 6 6
      web/src/view/superAdmin/authority/components/apis.vue
  60. 1 1
      web/src/view/superAdmin/authority/components/datas.vue
  61. 6 4
      web/src/view/superAdmin/authority/components/menus.vue
  62. 3 13
      web/src/view/superAdmin/menu/menu.vue
  63. 3 9
      web/src/view/superAdmin/user/user.vue
  64. 2 2
      web/src/view/systemTools/system/system.vue
  65. 1 1
      web/src/view/workflow/workflowCreate/workflowCreate.vue
  66. 4 4
      web/vue.config.js

+ 22 - 23
README.md

@@ -38,31 +38,30 @@
 ## 3. 项目目录
 ## 3. 项目目录
 
 
 ```
 ```
-    ├─QMPlusServer  	(后端文件夹)
-    │  ├─cmd     	(启动文件)
-    │  ├─config    	(配置包)
-    │  ├─controller  	(api和servers存放位置)
-    │  ├─db       	(数据库脚本)
-    │  ├─docs  	(swagger文档目录)
-    │  ├─init      	(初始化路由 数据库 日志等)
-    │  ├─log     	(日志存放地址)
-    │  ├─middleware   	(中间件)
-    │  ├─model            	(结构体层)
-    │  ├─router          	(路层)
-    │  ├─static	(静态文件--配置文件 casbin模型等)
-    │  ├─tools  (后端工具包)
-    │  └─tpl		(自动化代码模板)
-    └─QMPlusVuePage	(前端文件)
-        ├─public	(发布模板)
-        └─src
-            ├─api	(向后台发送ajax的封装层)
+    ├─erver  	    (后端文件夹)
+    │  ├─api            (API)
+    │  ├─config         (配置包)
+    │  ├─core  	        (內核)
+    │  ├─db             (数据库脚本)
+    │  ├─docs  	        (swagger文档目录)
+    │  ├─global         (全局对象)
+    │  ├─initialiaze    (初始化)
+    │  ├─middleware     (中间件)
+    │  ├─model          (结构体层)
+    │  ├─resource       (资源)
+    │  ├─router         (路层)
+    │  └─urtils		    (公共功能)
+    └─web	         (前端文件)
+        ├─public	    (发布模板)
+        └─src           (源码包)
+            ├─api	    (向后台发送ajax的封装层)
             ├─assets	(静态文件)
             ├─assets	(静态文件)
             ├─components(组件)
             ├─components(组件)
             ├─router	(前端路由)
             ├─router	(前端路由)
-            ├─store	(vuex 状态管理仓)
-            ├─style	(通用样式文件)
-            ├─utils	(前端工具库)
-            └─view	(前端页面)
+            ├─store	    (vuex 状态管理仓)
+            ├─style	    (通用样式文件)
+            ├─utils	    (前端工具库)
+            └─view	    (前端页面)
 
 
 ```
 ```
 
 
@@ -250,4 +249,4 @@ swag init
 
 
 |  支付宝   | 微信  |
 |  支付宝   | 微信  |
 |  :---:  | :---: |
 |  :---:  | :---: |
-| ![markdown](http://qmplusimg.henrongyi.top/zfb.png "支付宝") |  ![markdown](http://qmplusimg.henrongyi.top/wxzf.png "微信") |
+| ![markdown](http://qmplusimg.henrongyi.top/zfb.png "支付宝") |  ![markdown](http://qmplusimg.henrongyi.top/wxzf.png "微信") |

+ 0 - 29
docker-compose.yml

@@ -1,29 +0,0 @@
-# 关于Compose文件的具体说明,请参考以下链接:
-# https://docs.docker.com/compose/compose-file/
-
-version: "3.5"
-services:
-  # 数据库的各种配置参数,请参考以下链接:
-  # https://github.com/piexlmax/gin-vue-admin/blob/master/QMPlusServer/db/qmplus.sql#L4-L8
-  # https://github.com/piexlmax/gin-vue-admin/blob/master/QMPlusServer/static/config/config.json#L8-L14
-  database:
-    image: mysql:5.6
-    ports:
-      - 3306:3306
-    volumes:
-      - ./QMPlusServer/db:/docker-entrypoint-initdb.d
-    environment:
-      MYSQL_ROOT_PASSWORD: Aa@6447985
-      MYSQL_DATABASE: qmPlus
-    user: root
-  server:
-    build: ./QMPlusServer
-    ports:
-      - 8080:8080
-      - 8888:8888
-    environment:
-      MYSQLHOST: database
-    working_dir: /go/src/gin-vue-admin
-    restart: always
-    depends_on:
-      - database

+ 5 - 5
server/api/v1/exa_breakpoint_continue.go

@@ -15,7 +15,7 @@ import (
 // @Security ApiKeyAuth
 // @Security ApiKeyAuth
 // @accept multipart/form-data
 // @accept multipart/form-data
 // @Produce  application/json
 // @Produce  application/json
-// @Param file formData file true "断点续传示例"
+// @Param file formData file true "an example for breakpoint resume, 断点续传示例"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"上传成功"}"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"上传成功"}"
 // @Router /fileUploadAndDownload/breakpointContinue [post]
 // @Router /fileUploadAndDownload/breakpointContinue [post]
 func BreakpointContinue(c *gin.Context) {
 func BreakpointContinue(c *gin.Context) {
@@ -62,7 +62,7 @@ func BreakpointContinue(c *gin.Context) {
 // @Security ApiKeyAuth
 // @Security ApiKeyAuth
 // @accept multipart/form-data
 // @accept multipart/form-data
 // @Produce  application/json
 // @Produce  application/json
-// @Param file formData file true "查找文件"
+// @Param file formData file true "Find the file, 查找文件"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"查找成功"}"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"查找成功"}"
 // @Router /fileUploadAndDownload/findFile [post]
 // @Router /fileUploadAndDownload/findFile [post]
 func FindFile(c *gin.Context) {
 func FindFile(c *gin.Context) {
@@ -82,8 +82,8 @@ func FindFile(c *gin.Context) {
 // @Security ApiKeyAuth
 // @Security ApiKeyAuth
 // @accept multipart/form-data
 // @accept multipart/form-data
 // @Produce  application/json
 // @Produce  application/json
-// @Param file formData file true "查找文件"
-// @Success 200 {string} string "{"success":true,"data":{},"msg":"查找成功"}"
+// @Param file formData file true "上传文件完成"
+// @Success 200 {string} string "{"success":true,"data":{},"msg":"file uploaded, 文件创建成功"}"
 // @Router /fileUploadAndDownload/findFile [post]
 // @Router /fileUploadAndDownload/findFile [post]
 func BreakpointContinueFinish(c *gin.Context) {
 func BreakpointContinueFinish(c *gin.Context) {
 	fileMd5 := c.Query("fileMd5")
 	fileMd5 := c.Query("fileMd5")
@@ -101,7 +101,7 @@ func BreakpointContinueFinish(c *gin.Context) {
 // @Security ApiKeyAuth
 // @Security ApiKeyAuth
 // @accept multipart/form-data
 // @accept multipart/form-data
 // @Produce  application/json
 // @Produce  application/json
-// @Param file formData file true "查找文件"
+// @Param file formData file true "删除缓存切片"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"查找成功"}"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"查找成功"}"
 // @Router /fileUploadAndDownload/removeChunk [post]
 // @Router /fileUploadAndDownload/removeChunk [post]
 func RemoveChunk(c *gin.Context) {
 func RemoveChunk(c *gin.Context) {

+ 0 - 9
server/api/v1/sys_api.go

@@ -7,15 +7,6 @@ import (
 	"github.com/gin-gonic/gin"
 	"github.com/gin-gonic/gin"
 )
 )
 
 
-type CreateApiParams struct {
-	Path        string `json:"path"`
-	Description string `json:"description"`
-}
-
-type DeleteApiParams struct {
-	ID uint `json:"id"`
-}
-
 // @Tags SysApi
 // @Tags SysApi
 // @Summary 创建基础api
 // @Summary 创建基础api
 // @Security ApiKeyAuth
 // @Security ApiKeyAuth

+ 0 - 1
server/api/v1/sys_captcha.go

@@ -8,7 +8,6 @@ import (
 	"github.com/gin-gonic/gin"
 	"github.com/gin-gonic/gin"
 )
 )
 
 
-// 获取图片验证码id
 // @Tags base
 // @Tags base
 // @Summary 生成验证码
 // @Summary 生成验证码
 // @Security ApiKeyAuth
 // @Security ApiKeyAuth

+ 3 - 3
server/api/v1/sys_casbin.go

@@ -14,11 +14,11 @@ import (
 // @Produce application/json
 // @Produce application/json
 // @Param data body sysModel.CasbinInReceive true "更改角色api权限"
 // @Param data body sysModel.CasbinInReceive true "更改角色api权限"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
-// @Router /casbin/casbinPUpdate [post]
-func CasbinPUpdate(c *gin.Context) {
+// @Router /casbin/UpdateCasbin [post]
+func UpdateCasbin(c *gin.Context) {
 	var cmr model.CasbinInReceive
 	var cmr model.CasbinInReceive
 	_ = c.ShouldBindJSON(&cmr)
 	_ = c.ShouldBindJSON(&cmr)
-	err := new(model.CasbinModel).CasbinPUpdate(cmr.AuthorityId, cmr.CasbinInfos)
+	err := new(model.CasbinModel).UpdateCasbin(cmr.AuthorityId, cmr.CasbinInfos)
 	if err != nil {
 	if err != nil {
 		response.Result(response.ERROR, gin.H{}, fmt.Sprintf("添加规则失败,%v", err), c)
 		response.Result(response.ERROR, gin.H{}, fmt.Sprintf("添加规则失败,%v", err), c)
 	} else {
 	} else {

+ 25 - 22
server/api/v1/sys_menu.go

@@ -2,6 +2,7 @@ package v1
 
 
 import (
 import (
 	"fmt"
 	"fmt"
+	"gin-vue-admin/global/response"
 	"gin-vue-admin/middleware"
 	"gin-vue-admin/middleware"
 	"gin-vue-admin/model"
 	"gin-vue-admin/model"
 	"github.com/gin-gonic/gin"
 	"github.com/gin-gonic/gin"
@@ -11,7 +12,7 @@ import (
 // @Summary 获取用户动态路由
 // @Summary 获取用户动态路由
 // @Security ApiKeyAuth
 // @Security ApiKeyAuth
 // @Produce  application/json
 // @Produce  application/json
-// @Param data body api.RegisterAndLoginStuct true "可以什么都不填"
+// @Param data body api.RegisterAndLoginStruct true "可以什么都不填"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}"
 // @Router /menu/getMenu [post]
 // @Router /menu/getMenu [post]
 func GetMenu(c *gin.Context) {
 func GetMenu(c *gin.Context) {
@@ -19,9 +20,9 @@ func GetMenu(c *gin.Context) {
 	waitUse := claims.(*middleware.CustomClaims)
 	waitUse := claims.(*middleware.CustomClaims)
 	err, menus := new(model.SysMenu).GetMenuTree(waitUse.AuthorityId)
 	err, menus := new(model.SysMenu).GetMenuTree(waitUse.AuthorityId)
 	if err != nil {
 	if err != nil {
-		servers.ReportFormat(c, false, fmt.Sprintf("获取失败:%v", err), gin.H{"menus": menus})
+		response.Result(response.ERROR, gin.H{}, fmt.Sprintf("获取失败,%v", err), c)
 	} else {
 	} else {
-		servers.ReportFormat(c, true, "获取成功", gin.H{"menus": menus})
+		response.Result(response.SUCCESS, gin.H{"menus": menus}, "获取成功", c)
 	}
 	}
 }
 }
 
 
@@ -38,14 +39,14 @@ func GetMenuList(c *gin.Context) {
 	_ = c.ShouldBindJSON(&pageInfo)
 	_ = c.ShouldBindJSON(&pageInfo)
 	err, menuList, total := new(model.SysBaseMenu).GetInfoList(pageInfo)
 	err, menuList, total := new(model.SysBaseMenu).GetInfoList(pageInfo)
 	if err != nil {
 	if err != nil {
-		servers.ReportFormat(c, false, fmt.Sprintf("获取数据失败,%v", err), gin.H{})
+		response.Result(response.ERROR, gin.H{}, fmt.Sprintf("获取数据失败,%v", err), c)
 	} else {
 	} else {
-		servers.ReportFormat(c, true, "获取数据成功", gin.H{
+		response.Result(response.SUCCESS, gin.H{
 			"list":     menuList,
 			"list":     menuList,
 			"total":    total,
 			"total":    total,
 			"page":     pageInfo.Page,
 			"page":     pageInfo.Page,
 			"pageSize": pageInfo.PageSize,
 			"pageSize": pageInfo.PageSize,
-		})
+		}, "获取数据成功", c)
 	}
 	}
 }
 }
 
 
@@ -62,9 +63,9 @@ func AddBaseMenu(c *gin.Context) {
 	_ = c.ShouldBindJSON(&addMenu)
 	_ = c.ShouldBindJSON(&addMenu)
 	err := addMenu.AddBaseMenu()
 	err := addMenu.AddBaseMenu()
 	if err != nil {
 	if err != nil {
-		servers.ReportFormat(c, false, fmt.Sprintf("添加失败,%v", err), gin.H{})
+		response.Result(response.ERROR, gin.H{}, fmt.Sprintf("添加失败,%v", err), c)
 	} else {
 	} else {
-		servers.ReportFormat(c, true, fmt.Sprintf("添加成功,%v", err), gin.H{})
+		response.Result(response.SUCCESS, gin.H{}, "添加成功", c)
 	}
 	}
 }
 }
 
 
@@ -72,15 +73,16 @@ func AddBaseMenu(c *gin.Context) {
 // @Summary 获取用户动态路由
 // @Summary 获取用户动态路由
 // @Security ApiKeyAuth
 // @Security ApiKeyAuth
 // @Produce  application/json
 // @Produce  application/json
-// @Param data body api.RegisterAndLoginStuct true "可以什么都不填"
+// @Param data body api.RegisterAndLoginStruct true "可以什么都不填"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}"
 // @Router /menu/getBaseMenuTree [post]
 // @Router /menu/getBaseMenuTree [post]
 func GetBaseMenuTree(c *gin.Context) {
 func GetBaseMenuTree(c *gin.Context) {
 	err, menus := new(model.SysBaseMenu).GetBaseMenuTree()
 	err, menus := new(model.SysBaseMenu).GetBaseMenuTree()
 	if err != nil {
 	if err != nil {
-		servers.ReportFormat(c, false, fmt.Sprintf("获取失败:%v", err), gin.H{"menus": menus})
+		response.Result(response.ERROR, gin.H{"menus": menus}, fmt.Sprintf("获取失败,%v", err), c)
 	} else {
 	} else {
-		servers.ReportFormat(c, true, "获取成功", gin.H{"menus": menus})
+		response.Result(response.SUCCESS, gin.H{"menus": menus}, "获取成功", c)
+
 	}
 	}
 }
 }
 
 
@@ -103,9 +105,9 @@ func AddMenuAuthority(c *gin.Context) {
 
 
 	err := new(model.SysMenu).AddMenuAuthority(addMenuAuthorityInfo.Menus, addMenuAuthorityInfo.AuthorityId)
 	err := new(model.SysMenu).AddMenuAuthority(addMenuAuthorityInfo.Menus, addMenuAuthorityInfo.AuthorityId)
 	if err != nil {
 	if err != nil {
-		servers.ReportFormat(c, false, fmt.Sprintf("添加失败,%v", err), gin.H{})
+		response.Result(response.ERROR, gin.H{}, fmt.Sprintf("添加失败,%v", err), c)
 	} else {
 	} else {
-		servers.ReportFormat(c, true, fmt.Sprintf("添加成功,%v", err), gin.H{})
+		response.Result(response.SUCCESS, gin.H{}, "添加成功", c)
 	}
 	}
 }
 }
 
 
@@ -120,15 +122,15 @@ type AuthorityIdInfo struct {
 // @Produce application/json
 // @Produce application/json
 // @Param data body api.AuthorityIdInfo true "增加menu和角色关联关系"
 // @Param data body api.AuthorityIdInfo true "增加menu和角色关联关系"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
-// @Router /menu/addMenuAuthority [post]
+// @Router /menu/GetMenuAuthority [post]
 func GetMenuAuthority(c *gin.Context) {
 func GetMenuAuthority(c *gin.Context) {
 	var authorityIdInfo AuthorityIdInfo
 	var authorityIdInfo AuthorityIdInfo
 	_ = c.ShouldBindJSON(&authorityIdInfo)
 	_ = c.ShouldBindJSON(&authorityIdInfo)
 	err, menus := new(model.SysMenu).GetMenuAuthority(authorityIdInfo.AuthorityId)
 	err, menus := new(model.SysMenu).GetMenuAuthority(authorityIdInfo.AuthorityId)
 	if err != nil {
 	if err != nil {
-		servers.ReportFormat(c, false, fmt.Sprintf("获取失败:%v", err), gin.H{"menus": menus})
+		response.Result(response.ERROR, gin.H{"menus": menus}, fmt.Sprintf("添加失败,%v", err), c)
 	} else {
 	} else {
-		servers.ReportFormat(c, true, "获取成功", gin.H{"menus": menus})
+		response.Result(response.SUCCESS, gin.H{"menus": menus}, "获取成功", c)
 	}
 	}
 }
 }
 
 
@@ -149,9 +151,10 @@ func DeleteBaseMenu(c *gin.Context) {
 	_ = c.ShouldBindJSON(&idInfo)
 	_ = c.ShouldBindJSON(&idInfo)
 	err := new(model.SysBaseMenu).DeleteBaseMenu(idInfo.Id)
 	err := new(model.SysBaseMenu).DeleteBaseMenu(idInfo.Id)
 	if err != nil {
 	if err != nil {
-		servers.ReportFormat(c, false, fmt.Sprintf("删除失败:%v", err), gin.H{})
+		response.Result(response.ERROR, gin.H{}, fmt.Sprintf("删除失败:%v", err), c)
 	} else {
 	} else {
-		servers.ReportFormat(c, true, "删除成功", gin.H{})
+		response.Result(response.SUCCESS, gin.H{}, "删除成功", c)
+
 	}
 	}
 }
 }
 
 
@@ -168,9 +171,9 @@ func UpdateBaseMenu(c *gin.Context) {
 	_ = c.ShouldBindJSON(&menu)
 	_ = c.ShouldBindJSON(&menu)
 	err := menu.UpdateBaseMenu()
 	err := menu.UpdateBaseMenu()
 	if err != nil {
 	if err != nil {
-		servers.ReportFormat(c, false, fmt.Sprintf("修改失败:%v", err), gin.H{})
+		response.Result(response.ERROR, gin.H{}, fmt.Sprintf("修改失败:%v", err), c)
 	} else {
 	} else {
-		servers.ReportFormat(c, true, "修改成功", gin.H{})
+		response.Result(response.SUCCESS, gin.H{}, "修改成功", c)
 	}
 	}
 }
 }
 
 
@@ -191,8 +194,8 @@ func GetBaseMenuById(c *gin.Context) {
 	_ = c.ShouldBindJSON(&idInfo)
 	_ = c.ShouldBindJSON(&idInfo)
 	err, menu := new(model.SysBaseMenu).GetBaseMenuById(idInfo.Id)
 	err, menu := new(model.SysBaseMenu).GetBaseMenuById(idInfo.Id)
 	if err != nil {
 	if err != nil {
-		servers.ReportFormat(c, false, fmt.Sprintf("查询失败:%v", err), gin.H{})
+		response.Result(response.ERROR, gin.H{}, fmt.Sprintf("查询失败:%v", err), c)
 	} else {
 	} else {
-		servers.ReportFormat(c, true, "查询成功", gin.H{"menu": menu})
+		response.Result(response.SUCCESS, gin.H{"menu": menu}, "查询成功", c)
 	}
 	}
 }
 }

+ 4 - 20
server/api/v1/sys_user.go

@@ -16,26 +16,10 @@ import (
 	"time"
 	"time"
 )
 )
 
 
-var (
+const (
 	USER_HEADER_IMG_PATH string = "http://qmplusimg.henrongyi.top"
 	USER_HEADER_IMG_PATH string = "http://qmplusimg.henrongyi.top"
 	USER_HEADER_BUCKET   string = "qm-plus-img"
 	USER_HEADER_BUCKET   string = "qm-plus-img"
 )
 )
-
-type RegisterAndLoginStuct struct {
-	Username  string `json:"username"`
-	Password  string `json:"password"`
-	Captcha   string `json:"captcha"`
-	CaptchaId string `json:"captchaId"`
-}
-
-type RegestStuct struct {
-	Username    string `json:"userName"`
-	Password    string `json:"passWord"`
-	NickName    string `json:"nickName" gorm:"default:'QMPlusUser'"`
-	HeaderImg   string `json:"headerImg" gorm:"default:'http://www.henrongyi.top/avatar/lufu.jpg'"`
-	AuthorityId string `json:"authorityId" gorm:"default:888"`
-}
-
 // @Tags Base
 // @Tags Base
 // @Summary 用户注册账号
 // @Summary 用户注册账号
 // @Produce  application/json
 // @Produce  application/json
@@ -43,7 +27,7 @@ type RegestStuct struct {
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"注册成功"}"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"注册成功"}"
 // @Router /base/register [post]
 // @Router /base/register [post]
 func Register(c *gin.Context) {
 func Register(c *gin.Context) {
-	var R RegestStuct
+	var R model.RegisterStruct
 	_ = c.ShouldBindJSON(&R)
 	_ = c.ShouldBindJSON(&R)
 	user := &model.SysUser{Username: R.Username, NickName: R.NickName, Password: R.Password, HeaderImg: R.HeaderImg, AuthorityId: R.AuthorityId}
 	user := &model.SysUser{Username: R.Username, NickName: R.NickName, Password: R.Password, HeaderImg: R.HeaderImg, AuthorityId: R.AuthorityId}
 	err, user := user.Register()
 	err, user := user.Register()
@@ -61,11 +45,11 @@ func Register(c *gin.Context) {
 // @Tags Base
 // @Tags Base
 // @Summary 用户登录
 // @Summary 用户登录
 // @Produce  application/json
 // @Produce  application/json
-// @Param data body api.RegisterAndLoginStuct true "用户登录接口"
+// @Param data body api.RegisterAndLoginStruct true "用户登录接口"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"登陆成功"}"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"登陆成功"}"
 // @Router /base/login [post]
 // @Router /base/login [post]
 func Login(c *gin.Context) {
 func Login(c *gin.Context) {
-	var L RegisterAndLoginStuct
+	var L model.RegisterAndLoginStruct
 	_ = c.ShouldBindJSON(&L)
 	_ = c.ShouldBindJSON(&L)
 	if captcha.VerifyString(L.CaptchaId, L.Captcha) {
 	if captcha.VerifyString(L.CaptchaId, L.Captcha) {
 		U := &model.SysUser{Username: L.Username, Password: L.Password}
 		U := &model.SysUser{Username: L.Username, Password: L.Password}

+ 0 - 43
server/config.json

@@ -1,43 +0,0 @@
-{
-    "casbinconfig": {
-        "modelPath": "./resource/rbac_model.conf"
-    },
-    "jwt": {
-        "signingKey": "qmPlus"
-    },
-    "mysqladmin": {
-        "username": "root",
-        "password": "Aa@6447985",
-        "path": "127.0.0.1:3306",
-        "dbname": "qmPlus",
-        "config": "charset=utf8\u0026parseTime=True\u0026loc=Local",
-        "maxIdleConns": 10,
-        "maxOpenConns": 100,
-        "logMode": true
-    },
-    "qiniu": {
-        "accessKey": "25j8dYBZ2wuiy0yhwShytjZDTX662b8xiFguwxzZ",
-        "secretKey": "pgdbqEsf7ooZh7W3xokP833h3dZ_VecFXPDeG5JY"
-    },
-    "redisadmin": {
-        "addr": "127.0.0.1:6379",
-        "password": "",
-        "db": 0
-    },
-    "system": {
-        "useMultipoint": false,
-        "env": "develop",
-        "addr": 8888
-    },
-    "captcha": {
-        "keyLong": 6,
-        "imgWidth": 120,
-        "imgHeight": 40
-    },
-    "log": {
-        "prefix": "[GIN-VUE-ADMIN]",
-        "logFile": false,
-        "stdout": ["DEBUG"],
-        "file": ["WARNING"]
-    }
-}

+ 50 - 0
server/config.yaml

@@ -0,0 +1,50 @@
+# Gin-Vue-Admin Global Configuration
+
+# casbin configuration
+casbin:
+    model-path: './resource/rbac_model.conf'
+
+# jwt configuration
+jwt:
+    signing-key: 'qmPlus'
+
+# mysql connect configuration
+mysql:
+    username: root
+    password: 'Aa@6447985'
+    path: '127.0.0.1:3306'
+    db-name: 'qmPlus'
+    config: 'charset=utf8&parseTime=True&loc=Local'
+    max-idle-conns: 10
+    max-open-conns: 10
+    log-mode: true
+
+# oss configuration
+qiniu:
+    access-key: '25j8dYBZ2wuiy0yhwShytjZDTX662b8xiFguwxzZ'
+    secret-key: 'pgdbqEsf7ooZh7W3xokP833h3dZ_VecFXPDeG5JY'
+
+# redis configuration
+redis:
+    addr: '127.0.0.1:6379'
+    passwprd: ''
+    db: 0
+
+# system configuration
+system:
+    use-multipoint: false
+    env: 'develop'
+    addr: 8888
+
+# captcha configuration
+captcha:
+    key-long: 6
+    img-width: 120
+    img-height: 40
+
+# logger configuration
+log:
+    prefix: '[GIN-VUE-ADMIN]'
+    log-file: true
+    stdout: 'DEBUG'
+    file: 'DEBUG'

+ 60 - 0
server/config/config.go

@@ -0,0 +1,60 @@
+package config
+
+type Server struct {
+	Mysql   `mapstructure:"mysql"`
+	Qiniu   `mapstructure:"qiniu"`
+	Casbin  `mapstructure:"casbin"`
+	Redis   `mapstructure:"redis"`
+	System  `mapstructure:"system"`
+	JWT     `mapstructure:"jwt"`
+	Captcha `mapstructure:"captcha"`
+	Log     `mapstructure:"log"`
+}
+
+type System struct {
+	UseMultipoint bool   `mapstructure:"use-multipoint"`
+	Env           string `mapstructure:"env"`
+	Addr          int    `mapstructure:"addr"`
+}
+
+type JWT struct {
+	SigningKey string `mapstructure:"signing-key"`
+}
+
+type Casbin struct {
+	ModelPath string `mapstructure:"model-path"`
+}
+
+type Mysql struct {
+	Username     string `mapstructure:"username"`
+	Password     string `mapstructure:"password"`
+	Path         string `mapstructure:"path"`
+	Dbname       string `mapstructure:"db-name"`
+	Config       string `mapstructure:"config"`
+	MaxIdleConns int    `mapstructure:"max-idle-conns"`
+	MaxOpenConns int    `mapstructure:"max-open-conns"`
+	LogMode      bool   `mapstructure:"log-mode"`
+}
+
+type Redis struct {
+	Addr     string `mapstructure:"addr"`
+	Password string `mapstructure:"password"`
+	DB       int    `mapstructure:"db"`
+}
+type Qiniu struct {
+	AccessKey string `mapstructure:"access-key"`
+	SecretKey string `mapstructure:"secret-key"`
+}
+
+type Captcha struct {
+	KeyLong   int `mapstructure:"key-long"`
+	ImgWidth  int `mapstructure:"img-width"`
+	ImgHeight int `mapstructure:"img-height"`
+}
+
+type Log struct {
+	Prefix  string `mapstructure:"prefix"`
+	LogFile bool   `mapstructure:"log-file"`
+	Stdout  string `mapstructure:"stdout"`
+	File    string `mapstructure:"file"`
+}

+ 31 - 0
server/core/config.go

@@ -0,0 +1,31 @@
+package core
+
+import (
+	"fmt"
+	"gin-vue-admin/global"
+	"github.com/fsnotify/fsnotify"
+	"github.com/spf13/viper"
+)
+
+const defaultConfigFile = "config.yaml"
+
+func init() {
+	v := viper.New()
+	v.SetConfigFile(defaultConfigFile)
+	err := v.ReadInConfig()
+	if err != nil {
+		panic(fmt.Errorf("Fatal error config file: %s \n", err))
+	}
+	v.WatchConfig()
+
+	v.OnConfigChange(func(e fsnotify.Event) {
+		fmt.Println("config file changed:", e.Name)
+		if err := v.Unmarshal(&global.GVA_CONFIG); err != nil {
+			fmt.Println(err)
+		}
+	})
+	if err := v.Unmarshal(&global.GVA_CONFIG); err != nil {
+		fmt.Println(err)
+	}
+	global.GVA_VP = v
+}

+ 21 - 58
server/init/qmlog/log.go → server/core/log.go

@@ -1,10 +1,9 @@
-package qmlog
+package core
 
 
-// Register logger
 import (
 import (
-	"errors"
 	"fmt"
 	"fmt"
-	"gin-vue-admin/init"
+	"gin-vue-admin/config"
+	"gin-vue-admin/global"
 	"gin-vue-admin/utils"
 	"gin-vue-admin/utils"
 	rotatelogs "github.com/lestrrat/go-file-rotatelogs"
 	rotatelogs "github.com/lestrrat/go-file-rotatelogs"
 	oplogging "github.com/op/go-logging"
 	oplogging "github.com/op/go-logging"
@@ -16,24 +15,18 @@ import (
 
 
 const (
 const (
 	logDir      = "log"
 	logDir      = "log"
-	logSoftLink = "api.log"
+	logSoftLink = "latest_log"
 	module      = "gin-vue-admin"
 	module      = "gin-vue-admin"
 )
 )
 
 
 var (
 var (
-	configNotFound = errors.New("logger prefix not found")
-
 	defaultFormatter = `%{time:2006/01/02 - 15:04:05.000} %{longfile} %{color:bold}▶ [%{level:.6s}] %{message}%{color:reset}`
 	defaultFormatter = `%{time:2006/01/02 - 15:04:05.000} %{longfile} %{color:bold}▶ [%{level:.6s}] %{message}%{color:reset}`
 )
 )
 
 
-type Logger struct {
-	logger *oplogging.Logger
-}
-
-func NewLogger() error {
-	c := init.GinVueAdminconfig.Log
+func init() {
+	c := global.GVA_CONFIG.Log
 	if c.Prefix == "" {
 	if c.Prefix == "" {
-		return configNotFound
+		_ = fmt.Errorf("logger prefix not found")
 	}
 	}
 	logger := oplogging.MustGetLogger(module)
 	logger := oplogging.MustGetLogger(module)
 	var backends []oplogging.Backend
 	var backends []oplogging.Backend
@@ -41,16 +34,14 @@ func NewLogger() error {
 	backends = registerFile(c, backends)
 	backends = registerFile(c, backends)
 
 
 	oplogging.SetBackend(backends...)
 	oplogging.SetBackend(backends...)
-	init.SetLogger(logger)
-	return nil
+	global.GVA_LOG = logger
 }
 }
 
 
-func registerStdout(c init.Log, backends []oplogging.Backend) []oplogging.Backend {
-	for _, v := range c.Stdout {
-		level, err := oplogging.LogLevel(v)
+func registerStdout(c config.Log, backends []oplogging.Backend) []oplogging.Backend {
+	if c.Stdout != "" {
+		level, err := oplogging.LogLevel(c.Stdout)
 		if err != nil {
 		if err != nil {
 			fmt.Println(err)
 			fmt.Println(err)
-			continue
 		}
 		}
 		backends = append(backends, createBackend(os.Stdout, c, level))
 		backends = append(backends, createBackend(os.Stdout, c, level))
 	}
 	}
@@ -58,18 +49,17 @@ func registerStdout(c init.Log, backends []oplogging.Backend) []oplogging.Backen
 	return backends
 	return backends
 }
 }
 
 
-func registerFile(c init.Log, backends []oplogging.Backend) []oplogging.Backend {
-	if len(c.File) > 0 {
+func registerFile(c config.Log, backends []oplogging.Backend) []oplogging.Backend {
+	if c.File != "" {
 		if ok, _ := utils.PathExists(logDir); !ok {
 		if ok, _ := utils.PathExists(logDir); !ok {
 			// directory not exist
 			// directory not exist
 			fmt.Println("create log directory")
 			fmt.Println("create log directory")
 			_ = os.Mkdir(logDir, os.ModePerm)
 			_ = os.Mkdir(logDir, os.ModePerm)
 		}
 		}
-		apiLogPath := logDir + string(os.PathSeparator) + logSoftLink
 		fileWriter, err := rotatelogs.New(
 		fileWriter, err := rotatelogs.New(
-			apiLogPath+".%Y-%m-%d-%H-%M.log",
+			logDir+string(os.PathSeparator)+"%Y-%m-%d-%H-%M.log",
 			// generate soft link, point to latest log file
 			// generate soft link, point to latest log file
-			rotatelogs.WithLinkName(apiLogPath),
+			rotatelogs.WithLinkName(logSoftLink),
 			// maximum time to save log files
 			// maximum time to save log files
 			rotatelogs.WithMaxAge(7*24*time.Hour),
 			rotatelogs.WithMaxAge(7*24*time.Hour),
 			// time period of log file switching
 			// time period of log file switching
@@ -79,20 +69,17 @@ func registerFile(c init.Log, backends []oplogging.Backend) []oplogging.Backend
 			fmt.Println(err)
 			fmt.Println(err)
 			return backends
 			return backends
 		}
 		}
-		for _, v := range c.File {
-			level, err := oplogging.LogLevel(v)
-			if err != nil {
-				fmt.Println(err)
-				continue
-			}
-			backends = append(backends, createBackend(fileWriter, c, level))
+		level, err := oplogging.LogLevel(c.File)
+		if err != nil {
+			fmt.Println(err)
 		}
 		}
+		backends = append(backends, createBackend(fileWriter, c, level))
 	}
 	}
 
 
 	return backends
 	return backends
 }
 }
 
 
-func createBackend(w io.Writer, c init.Log, level oplogging.Level) oplogging.Backend {
+func createBackend(w io.Writer, c config.Log, level oplogging.Level) oplogging.Backend {
 	backend := oplogging.NewLogBackend(w, c.Prefix, 0)
 	backend := oplogging.NewLogBackend(w, c.Prefix, 0)
 	stdoutWriter := false
 	stdoutWriter := false
 	if w == os.Stdout {
 	if w == os.Stdout {
@@ -104,7 +91,7 @@ func createBackend(w io.Writer, c init.Log, level oplogging.Level) oplogging.Bac
 	return backendLeveled
 	return backendLeveled
 }
 }
 
 
-func getLogFormatter(c init.Log, stdoutWriter bool) oplogging.Formatter {
+func getLogFormatter(c config.Log, stdoutWriter bool) oplogging.Formatter {
 	pattern := defaultFormatter
 	pattern := defaultFormatter
 	if !stdoutWriter {
 	if !stdoutWriter {
 		// Color is only required for console output
 		// Color is only required for console output
@@ -118,27 +105,3 @@ func getLogFormatter(c init.Log, stdoutWriter bool) oplogging.Formatter {
 	}
 	}
 	return oplogging.MustStringFormatter(pattern)
 	return oplogging.MustStringFormatter(pattern)
 }
 }
-
-func (l Logger) Debug(v ...interface{}) {
-	l.logger.Debug(v)
-}
-
-func (l Logger) Info(v ...interface{}) {
-	l.logger.Info(v)
-}
-
-func (l Logger) Warning(v ...interface{}) {
-	l.logger.Warning(v)
-}
-
-func (l Logger) Error(v ...interface{}) {
-	l.logger.Error(v)
-}
-
-func (l Logger) Critical(v ...interface{}) {
-	l.logger.Critical(v)
-}
-
-func (l Logger) Fatal(v ...interface{}) {
-	l.logger.Fatal(v)
-}

+ 5 - 5
server/core/server.go

@@ -3,7 +3,7 @@ package core
 import (
 import (
 	"fmt"
 	"fmt"
 	"gin-vue-admin/global"
 	"gin-vue-admin/global"
-	"gin-vue-admin/init"
+	"gin-vue-admin/initialize"
 	"net/http"
 	"net/http"
 	"time"
 	"time"
 )
 )
@@ -11,9 +11,9 @@ import (
 func RunWindowsServer() {
 func RunWindowsServer() {
 	if global.GVA_CONFIG.System.UseMultipoint {
 	if global.GVA_CONFIG.System.UseMultipoint {
 		// 初始化redis服务
 		// 初始化redis服务
-		init.RegisterRedis()
+		initialize.Redis()
 	}
 	}
-	Router := init.RegisterRouter()
+	Router := initialize.Routers()
 	Router.Static("/form-generator", "./resource/page")
 	Router.Static("/form-generator", "./resource/page")
 	address := fmt.Sprintf(":%d", global.GVA_CONFIG.System.Addr)
 	address := fmt.Sprintf(":%d", global.GVA_CONFIG.System.Addr)
 	s := &http.Server{
 	s := &http.Server{
@@ -24,11 +24,11 @@ func RunWindowsServer() {
 		MaxHeaderBytes: 1 << 20,
 		MaxHeaderBytes: 1 << 20,
 	}
 	}
 	time.Sleep(10 * time.Microsecond)
 	time.Sleep(10 * time.Microsecond)
-	init.L.Debug("server run success on ", address)
+	global.GVA_LOG.Debug("server run success on ", address)
 
 
 	fmt.Printf(`欢迎使用 Gin-Vue-Admin
 	fmt.Printf(`欢迎使用 Gin-Vue-Admin
 	默认自动化文档地址:http://127.0.0.1%s/swagger/index.html
 	默认自动化文档地址:http://127.0.0.1%s/swagger/index.html
 	默认前端文件运行地址:http://127.0.0.1:8080
 	默认前端文件运行地址:http://127.0.0.1:8080
 `, s.Addr)
 `, s.Addr)
-	 init.L.Error(s.ListenAndServe())
+	global.GVA_LOG.Error(s.ListenAndServe())
 }
 }

+ 3 - 3
server/db/casbin_rule.sql

@@ -27,7 +27,7 @@ INSERT INTO `casbin_rule` VALUES ('p', '8881', '/user/setUserAuthority', 'POST',
 INSERT INTO `casbin_rule` VALUES ('p', '8881', '/fileUploadAndDownload/upload', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '8881', '/fileUploadAndDownload/upload', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '8881', '/fileUploadAndDownload/getFileList', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '8881', '/fileUploadAndDownload/getFileList', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '8881', '/fileUploadAndDownload/deleteFile', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '8881', '/fileUploadAndDownload/deleteFile', 'POST', '', '', '');
-INSERT INTO `casbin_rule` VALUES ('p', '8881', '/casbin/casbinPUpdate', 'POST', '', '', '');
+INSERT INTO `casbin_rule` VALUES ('p', '8881', '/casbin/UpdateCasbin', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '8881', '/casbin/getPolicyPathByAuthorityId', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '8881', '/casbin/getPolicyPathByAuthorityId', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '8881', '/jwt/jsonInBlacklist', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '8881', '/jwt/jsonInBlacklist', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '8881', '/system/getSystemConfig', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '8881', '/system/getSystemConfig', 'POST', '', '', '');
@@ -66,7 +66,7 @@ INSERT INTO `casbin_rule` VALUES ('p', '9528', '/user/setUserAuthority', 'POST',
 INSERT INTO `casbin_rule` VALUES ('p', '9528', '/fileUploadAndDownload/upload', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '9528', '/fileUploadAndDownload/upload', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '9528', '/fileUploadAndDownload/getFileList', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '9528', '/fileUploadAndDownload/getFileList', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '9528', '/fileUploadAndDownload/deleteFile', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '9528', '/fileUploadAndDownload/deleteFile', 'POST', '', '', '');
-INSERT INTO `casbin_rule` VALUES ('p', '9528', '/casbin/casbinPUpdate', 'POST', '', '', '');
+INSERT INTO `casbin_rule` VALUES ('p', '9528', '/casbin/UpdateCasbin', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '9528', '/casbin/getPolicyPathByAuthorityId', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '9528', '/casbin/getPolicyPathByAuthorityId', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '9528', '/jwt/jsonInBlacklist', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '9528', '/jwt/jsonInBlacklist', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '9528', '/system/getSystemConfig', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '9528', '/system/getSystemConfig', 'POST', '', '', '');
@@ -106,7 +106,7 @@ INSERT INTO `casbin_rule` VALUES ('p', '888', '/user/setUserAuthority', 'POST',
 INSERT INTO `casbin_rule` VALUES ('p', '888', '/fileUploadAndDownload/upload', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '888', '/fileUploadAndDownload/upload', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '888', '/fileUploadAndDownload/getFileList', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '888', '/fileUploadAndDownload/getFileList', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '888', '/fileUploadAndDownload/deleteFile', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '888', '/fileUploadAndDownload/deleteFile', 'POST', '', '', '');
-INSERT INTO `casbin_rule` VALUES ('p', '888', '/casbin/casbinPUpdate', 'POST', '', '', '');
+INSERT INTO `casbin_rule` VALUES ('p', '888', '/casbin/UpdateCasbin', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '888', '/casbin/getPolicyPathByAuthorityId', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '888', '/casbin/getPolicyPathByAuthorityId', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '888', '/casbin/casbinTest/:pathParam', 'GET', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '888', '/casbin/casbinTest/:pathParam', 'GET', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '888', '/jwt/jsonInBlacklist', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '888', '/jwt/jsonInBlacklist', 'POST', '', '', '');

+ 85 - 49
server/db/qmplus.sql

@@ -11,7 +11,7 @@
  Target Server Version : 50640
  Target Server Version : 50640
  File Encoding         : 65001
  File Encoding         : 65001
 
 
- Date: 02/04/2020 22:37:06
+ Date: 05/04/2020 16:24:43
 */
 */
 
 
 SET NAMES utf8mb4;
 SET NAMES utf8mb4;
@@ -63,7 +63,7 @@ INSERT INTO `casbin_rule` VALUES ('p', '8881', '/user/setUserAuthority', 'POST',
 INSERT INTO `casbin_rule` VALUES ('p', '8881', '/fileUploadAndDownload/upload', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '8881', '/fileUploadAndDownload/upload', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '8881', '/fileUploadAndDownload/getFileList', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '8881', '/fileUploadAndDownload/getFileList', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '8881', '/fileUploadAndDownload/deleteFile', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '8881', '/fileUploadAndDownload/deleteFile', 'POST', '', '', '');
-INSERT INTO `casbin_rule` VALUES ('p', '8881', '/casbin/casbinPUpdate', 'POST', '', '', '');
+INSERT INTO `casbin_rule` VALUES ('p', '8881', '/casbin/UpdateCasbin', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '8881', '/casbin/getPolicyPathByAuthorityId', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '8881', '/casbin/getPolicyPathByAuthorityId', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '8881', '/jwt/jsonInBlacklist', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '8881', '/jwt/jsonInBlacklist', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '8881', '/system/getSystemConfig', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '8881', '/system/getSystemConfig', 'POST', '', '', '');
@@ -102,7 +102,7 @@ INSERT INTO `casbin_rule` VALUES ('p', '9528', '/user/setUserAuthority', 'POST',
 INSERT INTO `casbin_rule` VALUES ('p', '9528', '/fileUploadAndDownload/upload', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '9528', '/fileUploadAndDownload/upload', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '9528', '/fileUploadAndDownload/getFileList', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '9528', '/fileUploadAndDownload/getFileList', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '9528', '/fileUploadAndDownload/deleteFile', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '9528', '/fileUploadAndDownload/deleteFile', 'POST', '', '', '');
-INSERT INTO `casbin_rule` VALUES ('p', '9528', '/casbin/casbinPUpdate', 'POST', '', '', '');
+INSERT INTO `casbin_rule` VALUES ('p', '9528', '/casbin/UpdateCasbin', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '9528', '/casbin/getPolicyPathByAuthorityId', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '9528', '/casbin/getPolicyPathByAuthorityId', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '9528', '/jwt/jsonInBlacklist', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '9528', '/jwt/jsonInBlacklist', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '9528', '/system/getSystemConfig', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '9528', '/system/getSystemConfig', 'POST', '', '', '');
@@ -142,7 +142,7 @@ INSERT INTO `casbin_rule` VALUES ('p', '888', '/user/setUserAuthority', 'POST',
 INSERT INTO `casbin_rule` VALUES ('p', '888', '/fileUploadAndDownload/upload', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '888', '/fileUploadAndDownload/upload', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '888', '/fileUploadAndDownload/getFileList', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '888', '/fileUploadAndDownload/getFileList', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '888', '/fileUploadAndDownload/deleteFile', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '888', '/fileUploadAndDownload/deleteFile', 'POST', '', '', '');
-INSERT INTO `casbin_rule` VALUES ('p', '888', '/casbin/casbinPUpdate', 'POST', '', '', '');
+INSERT INTO `casbin_rule` VALUES ('p', '888', '/casbin/UpdateCasbin', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '888', '/casbin/getPolicyPathByAuthorityId', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '888', '/casbin/getPolicyPathByAuthorityId', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '888', '/casbin/casbinTest/:pathParam', 'GET', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '888', '/casbin/casbinTest/:pathParam', 'GET', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '888', '/jwt/jsonInBlacklist', 'POST', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '888', '/jwt/jsonInBlacklist', 'POST', '', '', '');
@@ -3923,7 +3923,7 @@ CREATE TABLE `sys_apis`  (
   `authority_id` int(10) UNSIGNED NULL DEFAULT NULL,
   `authority_id` int(10) UNSIGNED NULL DEFAULT NULL,
   `path` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
   `path` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
   `description` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
   `description` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `group` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
+  `api_group` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
   `method` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'POST',
   `method` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'POST',
   PRIMARY KEY (`id`) USING BTREE,
   PRIMARY KEY (`id`) USING BTREE,
   INDEX `idx_apis_deleted_at`(`deleted_at`) USING BTREE,
   INDEX `idx_apis_deleted_at`(`deleted_at`) USING BTREE,
@@ -3960,7 +3960,7 @@ INSERT INTO `sys_apis` VALUES (28, '2019-10-09 15:15:17', '2019-10-09 15:17:07',
 INSERT INTO `sys_apis` VALUES (29, '2019-10-09 23:01:40', '2019-10-09 23:01:40', NULL, NULL, '/user/setUserAuthority', '修改用户角色', 'user', 'POST');
 INSERT INTO `sys_apis` VALUES (29, '2019-10-09 23:01:40', '2019-10-09 23:01:40', NULL, NULL, '/user/setUserAuthority', '修改用户角色', 'user', 'POST');
 INSERT INTO `sys_apis` VALUES (30, '2019-10-26 20:14:38', '2019-10-26 20:14:38', NULL, NULL, '/fileUploadAndDownload/upload', '文件上传示例', 'fileUploadAndDownload', 'POST');
 INSERT INTO `sys_apis` VALUES (30, '2019-10-26 20:14:38', '2019-10-26 20:14:38', NULL, NULL, '/fileUploadAndDownload/upload', '文件上传示例', 'fileUploadAndDownload', 'POST');
 INSERT INTO `sys_apis` VALUES (31, '2019-10-26 20:14:59', '2019-10-26 20:14:59', NULL, NULL, '/fileUploadAndDownload/getFileList', '获取上传文件列表', 'fileUploadAndDownload', 'POST');
 INSERT INTO `sys_apis` VALUES (31, '2019-10-26 20:14:59', '2019-10-26 20:14:59', NULL, NULL, '/fileUploadAndDownload/getFileList', '获取上传文件列表', 'fileUploadAndDownload', 'POST');
-INSERT INTO `sys_apis` VALUES (32, '2019-12-12 13:28:47', '2019-12-12 13:28:47', NULL, NULL, '/casbin/casbinPUpdate', '更改角色api权限', 'casbin', 'POST');
+INSERT INTO `sys_apis` VALUES (32, '2019-12-12 13:28:47', '2019-12-12 13:28:47', NULL, NULL, '/casbin/UpdateCasbin', '更改角色api权限', 'casbin', 'POST');
 INSERT INTO `sys_apis` VALUES (33, '2019-12-12 13:28:59', '2019-12-12 13:28:59', NULL, NULL, '/casbin/getPolicyPathByAuthorityId', '获取权限列表', 'casbin', 'POST');
 INSERT INTO `sys_apis` VALUES (33, '2019-12-12 13:28:59', '2019-12-12 13:28:59', NULL, NULL, '/casbin/getPolicyPathByAuthorityId', '获取权限列表', 'casbin', 'POST');
 INSERT INTO `sys_apis` VALUES (34, '2019-12-12 17:02:15', '2019-12-12 17:02:15', NULL, NULL, '/fileUploadAndDownload/deleteFile', '删除文件', 'fileUploadAndDownload', 'POST');
 INSERT INTO `sys_apis` VALUES (34, '2019-12-12 17:02:15', '2019-12-12 17:02:15', NULL, NULL, '/fileUploadAndDownload/deleteFile', '删除文件', 'fileUploadAndDownload', 'POST');
 INSERT INTO `sys_apis` VALUES (35, '2019-12-28 18:18:07', '2019-12-28 18:18:07', NULL, NULL, '/jwt/jsonInBlacklist', 'jwt加入黑名单', 'jwt', 'POST');
 INSERT INTO `sys_apis` VALUES (35, '2019-12-28 18:18:07', '2019-12-28 18:18:07', NULL, NULL, '/jwt/jsonInBlacklist', 'jwt加入黑名单', 'jwt', 'POST');
@@ -3980,25 +3980,58 @@ INSERT INTO `sys_apis` VALUES (45, '2020-03-29 23:01:28', '2020-03-29 23:01:28',
 -- ----------------------------
 -- ----------------------------
 DROP TABLE IF EXISTS `sys_authorities`;
 DROP TABLE IF EXISTS `sys_authorities`;
 CREATE TABLE `sys_authorities`  (
 CREATE TABLE `sys_authorities`  (
-  `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
-  `created_at` timestamp(0) NULL DEFAULT NULL,
-  `updated_at` timestamp(0) NULL DEFAULT NULL,
-  `deleted_at` timestamp(0) NULL DEFAULT NULL,
   `authority_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
   `authority_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
   `authority_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
   `authority_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
   `parent_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
   `parent_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  PRIMARY KEY (`id`) USING BTREE,
+  `created_at` datetime(0) NULL DEFAULT NULL,
+  `updated_at` datetime(0) NULL DEFAULT NULL,
+  `deleted_at` datetime(0) NULL DEFAULT NULL,
+  PRIMARY KEY (`authority_id`) USING BTREE,
   UNIQUE INDEX `authority_id`(`authority_id`) USING BTREE,
   UNIQUE INDEX `authority_id`(`authority_id`) USING BTREE,
-  INDEX `idx_authorities_deleted_at`(`deleted_at`) USING BTREE,
   INDEX `idx_sys_authorities_deleted_at`(`deleted_at`) USING BTREE
   INDEX `idx_sys_authorities_deleted_at`(`deleted_at`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
 
 
 -- ----------------------------
 -- ----------------------------
 -- Records of sys_authorities
 -- Records of sys_authorities
 -- ----------------------------
 -- ----------------------------
-INSERT INTO `sys_authorities` VALUES (2, '2019-09-08 16:18:45', '2019-09-08 16:18:45', NULL, '888', '普通用户', '0');
-INSERT INTO `sys_authorities` VALUES (6, '2019-09-18 22:23:33', '2019-09-18 22:23:33', NULL, '9528', '测试角色', '0');
-INSERT INTO `sys_authorities` VALUES (8, '2019-12-28 18:19:13', '2019-12-28 18:19:13', NULL, '8881', '普通用户子角色', '888');
+INSERT INTO `sys_authorities` VALUES ('888', '普通用户', '0', '2020-04-04 11:44:56', NULL, NULL);
+INSERT INTO `sys_authorities` VALUES ('8881', '普通用户子角色', '888', '2020-04-04 11:44:56', NULL, NULL);
+INSERT INTO `sys_authorities` VALUES ('9528', '测试角色', '0', '2020-04-04 11:44:56', NULL, NULL);
+
+-- ----------------------------
+-- Table structure for sys_authority_menus
+-- ----------------------------
+DROP TABLE IF EXISTS `sys_authority_menus`;
+CREATE TABLE `sys_authority_menus`  (
+  `sys_authority_authority_id` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
+  `sys_base_menu_id` int(10) UNSIGNED NOT NULL DEFAULT 0,
+  PRIMARY KEY (`sys_authority_authority_id`, `sys_base_menu_id`) USING BTREE,
+  INDEX `sys_authority_authority_id`(`sys_authority_authority_id`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Compact;
+
+-- ----------------------------
+-- Records of sys_authority_menus
+-- ----------------------------
+INSERT INTO `sys_authority_menus` VALUES ('888', 1);
+INSERT INTO `sys_authority_menus` VALUES ('888', 2);
+INSERT INTO `sys_authority_menus` VALUES ('888', 3);
+INSERT INTO `sys_authority_menus` VALUES ('888', 4);
+INSERT INTO `sys_authority_menus` VALUES ('888', 5);
+INSERT INTO `sys_authority_menus` VALUES ('888', 6);
+INSERT INTO `sys_authority_menus` VALUES ('888', 17);
+INSERT INTO `sys_authority_menus` VALUES ('888', 18);
+INSERT INTO `sys_authority_menus` VALUES ('888', 19);
+INSERT INTO `sys_authority_menus` VALUES ('888', 20);
+INSERT INTO `sys_authority_menus` VALUES ('888', 21);
+INSERT INTO `sys_authority_menus` VALUES ('888', 22);
+INSERT INTO `sys_authority_menus` VALUES ('888', 23);
+INSERT INTO `sys_authority_menus` VALUES ('888', 26);
+INSERT INTO `sys_authority_menus` VALUES ('888', 33);
+INSERT INTO `sys_authority_menus` VALUES ('888', 34);
+INSERT INTO `sys_authority_menus` VALUES ('888', 38);
+INSERT INTO `sys_authority_menus` VALUES ('888', 40);
+INSERT INTO `sys_authority_menus` VALUES ('888', 41);
+INSERT INTO `sys_authority_menus` VALUES ('888', 42);
 
 
 -- ----------------------------
 -- ----------------------------
 -- Table structure for sys_base_menus
 -- Table structure for sys_base_menus
@@ -4061,22 +4094,19 @@ INSERT INTO `sys_base_menus` VALUES (42, '2020-04-02 14:19:36', '2020-04-02 14:2
 -- ----------------------------
 -- ----------------------------
 DROP TABLE IF EXISTS `sys_data_authority_id`;
 DROP TABLE IF EXISTS `sys_data_authority_id`;
 CREATE TABLE `sys_data_authority_id`  (
 CREATE TABLE `sys_data_authority_id`  (
-  `sys_authority_id` int(10) UNSIGNED NOT NULL DEFAULT 0,
-  `data_id` int(10) UNSIGNED NOT NULL DEFAULT 0,
-  PRIMARY KEY (`sys_authority_id`, `data_id`) USING BTREE
-) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
+  `sys_authority_authority_id` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
+  `data_authority_id` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
+  PRIMARY KEY (`sys_authority_authority_id`, `data_authority_id`) USING BTREE,
+  INDEX `sys_authority_authority_id`(`sys_authority_authority_id`) USING BTREE,
+  INDEX `data_authority_id`(`data_authority_id`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Compact;
 
 
 -- ----------------------------
 -- ----------------------------
 -- Records of sys_data_authority_id
 -- Records of sys_data_authority_id
 -- ----------------------------
 -- ----------------------------
-INSERT INTO `sys_data_authority_id` VALUES (2, 2);
-INSERT INTO `sys_data_authority_id` VALUES (2, 6);
-INSERT INTO `sys_data_authority_id` VALUES (2, 8);
-INSERT INTO `sys_data_authority_id` VALUES (6, 2);
-INSERT INTO `sys_data_authority_id` VALUES (6, 6);
-INSERT INTO `sys_data_authority_id` VALUES (8, 2);
-INSERT INTO `sys_data_authority_id` VALUES (8, 6);
-INSERT INTO `sys_data_authority_id` VALUES (8, 8);
+INSERT INTO `sys_data_authority_id` VALUES ('888', '888');
+INSERT INTO `sys_data_authority_id` VALUES ('888', '8881');
+INSERT INTO `sys_data_authority_id` VALUES ('888', '9528');
 
 
 -- ----------------------------
 -- ----------------------------
 -- Table structure for sys_menus
 -- Table structure for sys_menus
@@ -4102,7 +4132,7 @@ CREATE TABLE `sys_menus`  (
   PRIMARY KEY (`id`) USING BTREE,
   PRIMARY KEY (`id`) USING BTREE,
   INDEX `idx_menus_deleted_at`(`deleted_at`) USING BTREE,
   INDEX `idx_menus_deleted_at`(`deleted_at`) USING BTREE,
   INDEX `idx_sys_menus_deleted_at`(`deleted_at`) USING BTREE
   INDEX `idx_sys_menus_deleted_at`(`deleted_at`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 580 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
+) ENGINE = InnoDB AUTO_INCREMENT = 668 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
 
 
 -- ----------------------------
 -- ----------------------------
 -- Records of sys_menus
 -- Records of sys_menus
@@ -4140,26 +4170,26 @@ INSERT INTO `sys_menus` VALUES (517, '2019-10-20 11:23:39', '2019-12-12 16:58:23
 INSERT INTO `sys_menus` VALUES (518, '2019-10-20 11:27:02', '2019-12-12 16:58:27', NULL, 0, 9528, 'upload', 'upload', 0, 'view/example/upload/upload.vue', '上传下载', 'upload', 19, '26', '上传下载', '5');
 INSERT INTO `sys_menus` VALUES (518, '2019-10-20 11:27:02', '2019-12-12 16:58:27', NULL, 0, 9528, 'upload', 'upload', 0, 'view/example/upload/upload.vue', '上传下载', 'upload', 19, '26', '上传下载', '5');
 INSERT INTO `sys_menus` VALUES (519, '2020-02-17 16:20:47', '2020-02-24 19:45:40', NULL, 0, 9528, 'breakpoint', 'breakpoint', 0, 'view/example/breakpoint/breakpoint.vue', '断点续传', 'upload', 19, '33', '断点续传', '6');
 INSERT INTO `sys_menus` VALUES (519, '2020-02-17 16:20:47', '2020-02-24 19:45:40', NULL, 0, 9528, 'breakpoint', 'breakpoint', 0, 'view/example/breakpoint/breakpoint.vue', '断点续传', 'upload', 19, '33', '断点续传', '6');
 INSERT INTO `sys_menus` VALUES (520, '2020-02-24 19:48:37', '2020-03-27 20:05:38', NULL, 0, 9528, 'customer', 'customer', 0, 'view/example/customer/customer.vue', '客户列表(资源示例)', 's-custom', 19, '34', '客户列表(资源示例)', '7');
 INSERT INTO `sys_menus` VALUES (520, '2020-02-24 19:48:37', '2020-03-27 20:05:38', NULL, 0, 9528, 'customer', 'customer', 0, 'view/example/customer/customer.vue', '客户列表(资源示例)', 's-custom', 19, '34', '客户列表(资源示例)', '7');
-INSERT INTO `sys_menus` VALUES (560, '2019-09-19 22:05:18', '2020-04-02 22:33:49', NULL, 0, 888, 'dashbord', 'dashbord', 0, 'view/dashbord/index.vue', '仪表盘', 'setting', 0, '1', '仪表盘', '1');
-INSERT INTO `sys_menus` VALUES (561, '2019-09-19 22:06:17', '2020-03-27 20:33:58', NULL, 0, 888, 'test', 'test', 0, 'view/test/index.vue', '测试菜单', 'info', 0, '2', '测试菜单', '2');
-INSERT INTO `sys_menus` VALUES (562, '2019-09-19 22:06:38', '2019-12-12 16:51:31', NULL, 0, 888, 'admin', 'superAdmin', 0, 'view/superAdmin/index.vue', '超级管理员', 'user-solid', 0, '3', '超级管理员', '3');
-INSERT INTO `sys_menus` VALUES (563, '2019-09-19 22:11:53', '2019-09-19 22:11:53', NULL, 0, 888, 'authority', 'authority', 0, 'view/superAdmin/authority/authority.vue', '角色管理', 's-custom', 3, '4', '角色管理', '1');
-INSERT INTO `sys_menus` VALUES (564, '2019-09-19 22:13:18', '2019-12-12 16:57:20', NULL, 0, 888, 'menu', 'menu', 0, 'view/superAdmin/menu/menu.vue', '菜单管理', 's-order', 3, '5', '菜单管理', '2');
-INSERT INTO `sys_menus` VALUES (565, '2019-09-19 22:13:36', '2019-12-12 16:57:30', NULL, 0, 888, 'api', 'api', 0, 'view/superAdmin/api/api.vue', 'api管理', 's-platform', 3, '6', 'api管理', '3');
-INSERT INTO `sys_menus` VALUES (566, '2019-10-09 15:12:29', '2019-12-12 16:57:25', NULL, 0, 888, 'user', 'user', 0, 'view/superAdmin/user/user.vue', '用户管理', 'coordinate', 3, '17', '用户管理', '4');
-INSERT INTO `sys_menus` VALUES (567, '2019-10-15 22:27:22', '2019-12-12 16:51:33', NULL, 0, 888, 'person', 'person', 1, 'view/person/person.vue', '个人信息', 'user-solid', 0, '18', '个人信息', '4');
-INSERT INTO `sys_menus` VALUES (568, '2020-03-29 21:31:03', '2020-03-29 21:31:03', NULL, 0, 888, 'systemTools', 'systemTools', 0, 'view/systemTools/index.vue', '系统工具', 's-cooperation', 0, '38', '系统工具', '5');
-INSERT INTO `sys_menus` VALUES (569, '2020-03-29 21:35:10', '2020-03-29 21:35:10', NULL, 0, 888, 'autoCode', 'autoCode', 0, 'view/systemTools/autoCode/index.vue', '代码生成器', 'cpu', 38, '40', '代码生成器', '1');
-INSERT INTO `sys_menus` VALUES (570, '2020-03-29 21:36:26', '2020-03-29 21:36:26', NULL, 0, 888, 'formCreate', 'formCreate', 0, 'view/systemTools/formCreate/index.vue', '表单生成器', 'magic-stick', 38, '41', '表单生成器', '2');
-INSERT INTO `sys_menus` VALUES (571, '2020-04-02 14:19:36', '2020-04-02 14:20:16', NULL, 0, 888, 'system', 'system', 0, 'view/systemTools/system/system.vue', '系统配置', 's-operation', 38, '42', '系统配置', '3');
-INSERT INTO `sys_menus` VALUES (572, '2019-10-20 11:14:42', '2020-03-29 21:39:18', NULL, 0, 888, 'example', 'example', 0, 'view/example/index.vue', '示例文件', 's-management', 0, '19', '示例文件', '6');
-INSERT INTO `sys_menus` VALUES (573, '2019-10-20 11:18:11', '2019-10-20 11:18:11', NULL, 0, 888, 'table', 'table', 0, 'view/example/table/table.vue', '表格示例', 's-order', 19, '20', '表格示例', '1');
-INSERT INTO `sys_menus` VALUES (574, '2019-10-20 11:19:52', '2019-12-12 16:58:15', NULL, 0, 888, 'form', 'form', 0, 'view/example/form/form.vue', '表单示例', 'document', 19, '21', '表单示例', '2');
-INSERT INTO `sys_menus` VALUES (575, '2019-10-20 11:22:19', '2019-12-12 16:58:20', NULL, 0, 888, 'rte', 'rte', 0, 'view/example/rte/rte.vue', '富文本编辑器', 'reading', 19, '22', '富文本编辑器', '3');
-INSERT INTO `sys_menus` VALUES (576, '2019-10-20 11:23:39', '2019-12-12 16:58:23', NULL, 0, 888, 'excel', 'excel', 0, 'view/example/excel/excel.vue', 'excel导入导出', 's-marketing', 19, '23', 'excel导入导出', '4');
-INSERT INTO `sys_menus` VALUES (577, '2019-10-20 11:27:02', '2019-12-12 16:58:27', NULL, 0, 888, 'upload', 'upload', 0, 'view/example/upload/upload.vue', '上传下载', 'upload', 19, '26', '上传下载', '5');
-INSERT INTO `sys_menus` VALUES (578, '2020-02-17 16:20:47', '2020-02-24 19:45:40', NULL, 0, 888, 'breakpoint', 'breakpoint', 0, 'view/example/breakpoint/breakpoint.vue', '断点续传', 'upload', 19, '33', '断点续传', '6');
-INSERT INTO `sys_menus` VALUES (579, '2020-02-24 19:48:37', '2020-03-27 20:10:02', NULL, 0, 888, 'customer', 'customer', 0, 'view/example/customer/customer.vue', '客户列表(资源示例)', 's-custom', 19, '34', '客户列表(资源示例)', '7');
+INSERT INTO `sys_menus` VALUES (648, '2019-09-19 22:05:18', '2020-04-02 22:33:49', NULL, 0, 888, 'dashbord', 'dashbord', 0, 'view/dashbord/index.vue', '仪表盘', 'setting', 0, '1', '仪表盘', '1');
+INSERT INTO `sys_menus` VALUES (649, '2019-09-19 22:06:17', '2020-03-27 20:33:58', NULL, 0, 888, 'test', 'test', 0, 'view/test/index.vue', '测试菜单', 'info', 0, '2', '测试菜单', '2');
+INSERT INTO `sys_menus` VALUES (650, '2019-09-19 22:06:38', '2019-12-12 16:51:31', NULL, 0, 888, 'admin', 'superAdmin', 0, 'view/superAdmin/index.vue', '超级管理员', 'user-solid', 0, '3', '超级管理员', '3');
+INSERT INTO `sys_menus` VALUES (651, '2019-09-19 22:11:53', '2019-09-19 22:11:53', NULL, 0, 888, 'authority', 'authority', 0, 'view/superAdmin/authority/authority.vue', '角色管理', 's-custom', 3, '4', '角色管理', '1');
+INSERT INTO `sys_menus` VALUES (652, '2019-09-19 22:13:18', '2019-12-12 16:57:20', NULL, 0, 888, 'menu', 'menu', 0, 'view/superAdmin/menu/menu.vue', '菜单管理', 's-order', 3, '5', '菜单管理', '2');
+INSERT INTO `sys_menus` VALUES (653, '2019-09-19 22:13:36', '2019-12-12 16:57:30', NULL, 0, 888, 'api', 'api', 0, 'view/superAdmin/api/api.vue', 'api管理', 's-platform', 3, '6', 'api管理', '3');
+INSERT INTO `sys_menus` VALUES (654, '2019-10-09 15:12:29', '2019-12-12 16:57:25', NULL, 0, 888, 'user', 'user', 0, 'view/superAdmin/user/user.vue', '用户管理', 'coordinate', 3, '17', '用户管理', '4');
+INSERT INTO `sys_menus` VALUES (655, '2019-10-15 22:27:22', '2019-12-12 16:51:33', NULL, 0, 888, 'person', 'person', 1, 'view/person/person.vue', '个人信息', 'user-solid', 0, '18', '个人信息', '4');
+INSERT INTO `sys_menus` VALUES (656, '2020-03-29 21:31:03', '2020-03-29 21:31:03', NULL, 0, 888, 'systemTools', 'systemTools', 0, 'view/systemTools/index.vue', '系统工具', 's-cooperation', 0, '38', '系统工具', '5');
+INSERT INTO `sys_menus` VALUES (657, '2020-03-29 21:35:10', '2020-03-29 21:35:10', NULL, 0, 888, 'autoCode', 'autoCode', 0, 'view/systemTools/autoCode/index.vue', '代码生成器', 'cpu', 38, '40', '代码生成器', '1');
+INSERT INTO `sys_menus` VALUES (658, '2020-03-29 21:36:26', '2020-03-29 21:36:26', NULL, 0, 888, 'formCreate', 'formCreate', 0, 'view/systemTools/formCreate/index.vue', '表单生成器', 'magic-stick', 38, '41', '表单生成器', '2');
+INSERT INTO `sys_menus` VALUES (659, '2020-04-02 14:19:36', '2020-04-02 14:20:16', NULL, 0, 888, 'system', 'system', 0, 'view/systemTools/system/system.vue', '系统配置', 's-operation', 38, '42', '系统配置', '3');
+INSERT INTO `sys_menus` VALUES (660, '2019-10-20 11:14:42', '2020-03-29 21:39:18', NULL, 0, 888, 'example', 'example', 0, 'view/example/index.vue', '示例文件', 's-management', 0, '19', '示例文件', '6');
+INSERT INTO `sys_menus` VALUES (661, '2019-10-20 11:18:11', '2019-10-20 11:18:11', NULL, 0, 888, 'table', 'table', 0, 'view/example/table/table.vue', '表格示例', 's-order', 19, '20', '表格示例', '1');
+INSERT INTO `sys_menus` VALUES (662, '2019-10-20 11:19:52', '2019-12-12 16:58:15', NULL, 0, 888, 'form', 'form', 0, 'view/example/form/form.vue', '表单示例', 'document', 19, '21', '表单示例', '2');
+INSERT INTO `sys_menus` VALUES (663, '2019-10-20 11:22:19', '2019-12-12 16:58:20', NULL, 0, 888, 'rte', 'rte', 0, 'view/example/rte/rte.vue', '富文本编辑器', 'reading', 19, '22', '富文本编辑器', '3');
+INSERT INTO `sys_menus` VALUES (664, '2019-10-20 11:23:39', '2019-12-12 16:58:23', NULL, 0, 888, 'excel', 'excel', 0, 'view/example/excel/excel.vue', 'excel导入导出', 's-marketing', 19, '23', 'excel导入导出', '4');
+INSERT INTO `sys_menus` VALUES (665, '2019-10-20 11:27:02', '2019-12-12 16:58:27', NULL, 0, 888, 'upload', 'upload', 0, 'view/example/upload/upload.vue', '上传下载', 'upload', 19, '26', '上传下载', '5');
+INSERT INTO `sys_menus` VALUES (666, '2020-02-17 16:20:47', '2020-02-24 19:45:40', NULL, 0, 888, 'breakpoint', 'breakpoint', 0, 'view/example/breakpoint/breakpoint.vue', '断点续传', 'upload', 19, '33', '断点续传', '6');
+INSERT INTO `sys_menus` VALUES (667, '2020-02-24 19:48:37', '2020-03-27 20:10:02', NULL, 0, 888, 'customer', 'customer', 0, 'view/example/customer/customer.vue', '客户列表(资源示例)', 's-custom', 19, '34', '客户列表(资源示例)', '7');
 
 
 -- ----------------------------
 -- ----------------------------
 -- Table structure for sys_users
 -- Table structure for sys_users
@@ -4235,4 +4265,10 @@ CREATE TABLE `sys_workflows`  (
 -- ----------------------------
 -- ----------------------------
 INSERT INTO `sys_workflows` VALUES (8, '2019-12-09 15:20:21', '2019-12-09 15:20:21', NULL, '测试改版1', 'test', '123123');
 INSERT INTO `sys_workflows` VALUES (8, '2019-12-09 15:20:21', '2019-12-09 15:20:21', NULL, '测试改版1', 'test', '123123');
 
 
+-- ----------------------------
+-- View structure for 111
+-- ----------------------------
+DROP VIEW IF EXISTS `111`;
+CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `111` AS select `sys_base_menus`.`id` AS `id`,`sys_menus`.`menu_id` AS `menu_id`,`sys_base_menus`.`created_at` AS `created_at`,`sys_base_menus`.`updated_at` AS `updated_at`,`sys_base_menus`.`deleted_at` AS `deleted_at`,`sys_base_menus`.`menu_level` AS `menu_level`,`sys_base_menus`.`parent_id` AS `parent_id`,`sys_base_menus`.`path` AS `path`,`sys_base_menus`.`name` AS `name`,`sys_base_menus`.`hidden` AS `hidden`,`sys_base_menus`.`component` AS `component`,`sys_base_menus`.`title` AS `title`,`sys_base_menus`.`icon` AS `icon`,`sys_base_menus`.`nick_name` AS `nick_name`,`sys_base_menus`.`sort` AS `sort` from (`sys_menus` join `sys_base_menus` on((`sys_menus`.`menu_id` = `sys_base_menus`.`id`))) where (`sys_menus`.`authority_id` = 888);
+
 SET FOREIGN_KEY_CHECKS = 1;
 SET FOREIGN_KEY_CHECKS = 1;

+ 1 - 1
server/db/sys_apis.sql

@@ -25,7 +25,7 @@ INSERT INTO `sys_apis` VALUES (28, '2019-10-09 15:15:17', '2019-10-09 15:17:07',
 INSERT INTO `sys_apis` VALUES (29, '2019-10-09 23:01:40', '2019-10-09 23:01:40', NULL, NULL, '/user/setUserAuthority', '修改用户角色', 'user', 'POST');
 INSERT INTO `sys_apis` VALUES (29, '2019-10-09 23:01:40', '2019-10-09 23:01:40', NULL, NULL, '/user/setUserAuthority', '修改用户角色', 'user', 'POST');
 INSERT INTO `sys_apis` VALUES (30, '2019-10-26 20:14:38', '2019-10-26 20:14:38', NULL, NULL, '/fileUploadAndDownload/upload', '文件上传示例', 'fileUploadAndDownload', 'POST');
 INSERT INTO `sys_apis` VALUES (30, '2019-10-26 20:14:38', '2019-10-26 20:14:38', NULL, NULL, '/fileUploadAndDownload/upload', '文件上传示例', 'fileUploadAndDownload', 'POST');
 INSERT INTO `sys_apis` VALUES (31, '2019-10-26 20:14:59', '2019-10-26 20:14:59', NULL, NULL, '/fileUploadAndDownload/getFileList', '获取上传文件列表', 'fileUploadAndDownload', 'POST');
 INSERT INTO `sys_apis` VALUES (31, '2019-10-26 20:14:59', '2019-10-26 20:14:59', NULL, NULL, '/fileUploadAndDownload/getFileList', '获取上传文件列表', 'fileUploadAndDownload', 'POST');
-INSERT INTO `sys_apis` VALUES (32, '2019-12-12 13:28:47', '2019-12-12 13:28:47', NULL, NULL, '/casbin/casbinPUpdate', '更改角色api权限', 'casbin', 'POST');
+INSERT INTO `sys_apis` VALUES (32, '2019-12-12 13:28:47', '2019-12-12 13:28:47', NULL, NULL, '/casbin/UpdateCasbin', '更改角色api权限', 'casbin', 'POST');
 INSERT INTO `sys_apis` VALUES (33, '2019-12-12 13:28:59', '2019-12-12 13:28:59', NULL, NULL, '/casbin/getPolicyPathByAuthorityId', '获取权限列表', 'casbin', 'POST');
 INSERT INTO `sys_apis` VALUES (33, '2019-12-12 13:28:59', '2019-12-12 13:28:59', NULL, NULL, '/casbin/getPolicyPathByAuthorityId', '获取权限列表', 'casbin', 'POST');
 INSERT INTO `sys_apis` VALUES (34, '2019-12-12 17:02:15', '2019-12-12 17:02:15', NULL, NULL, '/fileUploadAndDownload/deleteFile', '删除文件', 'fileUploadAndDownload', 'POST');
 INSERT INTO `sys_apis` VALUES (34, '2019-12-12 17:02:15', '2019-12-12 17:02:15', NULL, NULL, '/fileUploadAndDownload/deleteFile', '删除文件', 'fileUploadAndDownload', 'POST');
 INSERT INTO `sys_apis` VALUES (35, '2019-12-28 18:18:07', '2019-12-28 18:18:07', NULL, NULL, '/jwt/jsonInBlacklist', 'jwt加入黑名单', 'jwt', 'POST');
 INSERT INTO `sys_apis` VALUES (35, '2019-12-28 18:18:07', '2019-12-28 18:18:07', NULL, NULL, '/jwt/jsonInBlacklist', 'jwt加入黑名单', 'jwt', 'POST');

+ 5 - 5
server/docs/docs.go

@@ -475,7 +475,7 @@ var doc = `{
                         "required": true,
                         "required": true,
                         "schema": {
                         "schema": {
                             "type": "object",
                             "type": "object",
-                            "$ref": "#/definitions/api.RegisterAndLoginStuct"
+                            "$ref": "#/definitions/api.RegisterAndLoginStruct"
                         }
                         }
                     }
                     }
                 ],
                 ],
@@ -559,7 +559,7 @@ var doc = `{
                 }
                 }
             }
             }
         },
         },
-        "/casbin/casbinPUpdate": {
+        "/casbin/UpdateCasbin": {
             "post": {
             "post": {
                 "security": [
                 "security": [
                     {
                     {
@@ -1256,7 +1256,7 @@ var doc = `{
                         "required": true,
                         "required": true,
                         "schema": {
                         "schema": {
                             "type": "object",
                             "type": "object",
-                            "$ref": "#/definitions/api.RegisterAndLoginStuct"
+                            "$ref": "#/definitions/api.RegisterAndLoginStruct"
                         }
                         }
                     }
                     }
                 ],
                 ],
@@ -1292,7 +1292,7 @@ var doc = `{
                         "required": true,
                         "required": true,
                         "schema": {
                         "schema": {
                             "type": "object",
                             "type": "object",
-                            "$ref": "#/definitions/api.RegisterAndLoginStuct"
+                            "$ref": "#/definitions/api.RegisterAndLoginStruct"
                         }
                         }
                     }
                     }
                 ],
                 ],
@@ -1752,7 +1752,7 @@ var doc = `{
                 }
                 }
             }
             }
         },
         },
-        "api.RegisterAndLoginStuct": {
+        "api.RegisterAndLoginStruct": {
             "type": "object",
             "type": "object",
             "properties": {
             "properties": {
                 "captcha": {
                 "captcha": {

+ 5 - 5
server/docs/swagger.json

@@ -458,7 +458,7 @@
                         "required": true,
                         "required": true,
                         "schema": {
                         "schema": {
                             "type": "object",
                             "type": "object",
-                            "$ref": "#/definitions/api.RegisterAndLoginStuct"
+                            "$ref": "#/definitions/api.RegisterAndLoginStruct"
                         }
                         }
                     }
                     }
                 ],
                 ],
@@ -542,7 +542,7 @@
                 }
                 }
             }
             }
         },
         },
-        "/casbin/casbinPUpdate": {
+        "/casbin/UpdateCasbin": {
             "post": {
             "post": {
                 "security": [
                 "security": [
                     {
                     {
@@ -1239,7 +1239,7 @@
                         "required": true,
                         "required": true,
                         "schema": {
                         "schema": {
                             "type": "object",
                             "type": "object",
-                            "$ref": "#/definitions/api.RegisterAndLoginStuct"
+                            "$ref": "#/definitions/api.RegisterAndLoginStruct"
                         }
                         }
                     }
                     }
                 ],
                 ],
@@ -1275,7 +1275,7 @@
                         "required": true,
                         "required": true,
                         "schema": {
                         "schema": {
                             "type": "object",
                             "type": "object",
-                            "$ref": "#/definitions/api.RegisterAndLoginStuct"
+                            "$ref": "#/definitions/api.RegisterAndLoginStruct"
                         }
                         }
                     }
                     }
                 ],
                 ],
@@ -1735,7 +1735,7 @@
                 }
                 }
             }
             }
         },
         },
-        "api.RegisterAndLoginStuct": {
+        "api.RegisterAndLoginStruct": {
             "type": "object",
             "type": "object",
             "properties": {
             "properties": {
                 "captcha": {
                 "captcha": {

+ 5 - 5
server/docs/swagger.yaml

@@ -52,7 +52,7 @@ definitions:
       id:
       id:
         type: number
         type: number
     type: object
     type: object
-  api.RegisterAndLoginStuct:
+  api.RegisterAndLoginStruct:
     properties:
     properties:
       captcha:
       captcha:
         type: string
         type: string
@@ -580,7 +580,7 @@ paths:
         name: data
         name: data
         required: true
         required: true
         schema:
         schema:
-          $ref: '#/definitions/api.RegisterAndLoginStuct'
+          $ref: '#/definitions/api.RegisterAndLoginStruct'
           type: object
           type: object
       produces:
       produces:
       - application/json
       - application/json
@@ -636,7 +636,7 @@ paths:
       summary: casb RBAC RESTFUL测试路由
       summary: casb RBAC RESTFUL测试路由
       tags:
       tags:
       - casbin
       - casbin
-  /casbin/casbinPUpdate:
+  /casbin/UpdateCasbin:
     post:
     post:
       consumes:
       consumes:
       - application/json
       - application/json
@@ -1058,7 +1058,7 @@ paths:
         name: data
         name: data
         required: true
         required: true
         schema:
         schema:
-          $ref: '#/definitions/api.RegisterAndLoginStuct'
+          $ref: '#/definitions/api.RegisterAndLoginStruct'
           type: object
           type: object
       produces:
       produces:
       - application/json
       - application/json
@@ -1080,7 +1080,7 @@ paths:
         name: data
         name: data
         required: true
         required: true
         schema:
         schema:
-          $ref: '#/definitions/api.RegisterAndLoginStuct'
+          $ref: '#/definitions/api.RegisterAndLoginStruct'
           type: object
           type: object
       produces:
       produces:
       - application/json
       - application/json

+ 4 - 3
server/global/global.go

@@ -1,16 +1,17 @@
 package global
 package global
 
 
 import (
 import (
-	"gin-vue-admin/init"
+	"gin-vue-admin/config"
 	"github.com/go-redis/redis"
 	"github.com/go-redis/redis"
 	"github.com/jinzhu/gorm"
 	"github.com/jinzhu/gorm"
+	oplogging "github.com/op/go-logging"
 	"github.com/spf13/viper"
 	"github.com/spf13/viper"
 )
 )
 
 
 var (
 var (
 	GVA_DB     *gorm.DB
 	GVA_DB     *gorm.DB
 	GVA_REDIS  *redis.Client
 	GVA_REDIS  *redis.Client
-	GVA_LOG    init.Logger
-	GVA_CONFIG init.Config
+	GVA_CONFIG config.Server
 	GVA_VP     *viper.Viper
 	GVA_VP     *viper.Viper
+	GVA_LOG    *oplogging.Logger
 )
 )

+ 5 - 5
server/global/response/response.go

@@ -5,10 +5,10 @@ import (
 	"net/http"
 	"net/http"
 )
 )
 
 
-type response struct {
-	code int
-	data interface{}
-	msg  string
+type Response struct {
+	Code int         `json:"code"`
+	Data interface{} `json:"data"`
+	Msg  string      `json:"msg"`
 }
 }
 
 
 const (
 const (
@@ -18,7 +18,7 @@ const (
 
 
 func Result(code int, data interface{}, msg string, c *gin.Context) {
 func Result(code int, data interface{}, msg string, c *gin.Context) {
 	// 开始时间
 	// 开始时间
-	c.JSON(http.StatusOK, response{
+	c.JSON(http.StatusOK, Response{
 		code,
 		code,
 		data,
 		data,
 		msg,
 		msg,

+ 0 - 103
server/init/config.go

@@ -1,103 +0,0 @@
-package init
-
-import (
-	"fmt"
-	"gin-vue-admin/global"
-	"github.com/fsnotify/fsnotify"
-	"github.com/spf13/viper"
-)
-
-type Config struct {
-	MysqlAdmin   MysqlAdmin   `json:"mysqlAdmin"`
-	Qiniu        Qiniu        `json:"qiniu"`
-	CasbinConfig CasbinConfig `json:"casbinConfig"`
-	RedisAdmin   RedisAdmin   `json:"redisAdmin"`
-	System       System       `json:"system"`
-	JWT          JWT          `json:"jwt"`
-	Captcha      Captcha      `json:"captcha"`
-	Log          Log          `json:"log"`
-}
-
-type System struct { // 系统配置
-	UseMultipoint bool   `json:"useMultipoint"`
-	Env           string `json:"env"`
-	Addr          int    `json:"addr"`
-}
-
-type JWT struct { // jwt签名
-	SigningKey string `json:"signingKey"`
-}
-
-type CasbinConfig struct { //casbin配置
-	ModelPath string `json:"modelPath"` // casbin model地址配置
-}
-
-type MysqlAdmin struct { // mysql admin 数据库配置
-	Username     string `json:"username"`
-	Password     string `json:"password"`
-	Path         string `json:"path"`
-	Dbname       string `json:"dbname"`
-	Config       string `json:"config"`
-	MaxIdleConns int    `json:"maxIdleConns"`
-	MaxOpenConns int    `json:"maxOpenConns"`
-	LogMode      bool   `json:"maxOpenConns"`
-}
-
-type RedisAdmin struct { // Redis admin 数据库配置
-	Addr     string `json:"addr"`
-	Password string `json:"password"`
-	DB       int    `json:"db"`
-}
-type Qiniu struct { // 七牛 密钥配置
-	AccessKey string `json:"accessKey"`
-	SecretKey string `json:"secretKey"`
-}
-
-type Captcha struct { // 验证码配置
-	KeyLong   int `json:"keyLong"`
-	ImgWidth  int `json:"imgWidth"`
-	ImgHeight int `json:"imgHeight"`
-}
-
-/**
-Log Config
-
-"CRITICAL"
-"ERROR"
-"WARNING"
-"NOTICE"
-"INFO"
-"DEBUG"
-*/
-type Log struct {
-	// log 打印的前缀
-	Prefix string `json:"prefix"`
-	// 是否显示打印log的文件具体路径
-	LogFile bool `json:"logFile"`
-	// 在控制台打印log的级别, []默认不打印
-	Stdout []string `json:"stdout"`
-	// 在文件中打印log的级别   []默认不打印
-	File []string `json:"file"`
-}
-
-func init() {
-	v := viper.New()
-	v.SetConfigName("config") //  设置配置文件名 (不带后缀)
-	v.AddConfigPath("/")      // 第一个搜索路径
-	v.SetConfigType("json")
-	err := v.ReadInConfig() // 搜索路径,并读取配置数据
-	if err != nil {
-		panic(fmt.Errorf("Fatal error config file: %s \n", err))
-	}
-	v.WatchConfig()
-	v.OnConfigChange(func(e fsnotify.Event) {
-		fmt.Println("config file changed:", e.Name)
-		if err := v.Unmarshal(&global.GVA_CONFIG); err != nil {
-			fmt.Println(err)
-		}
-	})
-	if err := v.Unmarshal(&global.GVA_CONFIG); err != nil {
-		fmt.Println(err)
-	}
-	global.GVA_VP = v
-}

+ 0 - 17
server/init/log.go

@@ -1,17 +0,0 @@
-package init
-
-// Custom Logger
-type Logger interface {
-	Debug(v ...interface{})
-	Info(v ...interface{})
-	Warning(v ...interface{})
-	Error(v ...interface{})
-	Critical(v ...interface{})
-	Fatal(v ...interface{})
-}
-
-var L Logger
-
-func SetLogger(logger Logger) {
-	L = logger
-}

+ 0 - 21
server/init/redis.go

@@ -1,21 +0,0 @@
-package init
-
-import (
-	"gin-vue-admin/global"
-	"github.com/go-redis/redis"
-)
-
-func RegisterRedis() {
-	client := redis.NewClient(&redis.Options{
-		Addr:     GinVueAdminconfig.RedisAdmin.Addr,
-		Password: GinVueAdminconfig.RedisAdmin.Password, // no password set
-		DB:       GinVueAdminconfig.RedisAdmin.DB,       // use default DB
-	})
-	pong, err := client.Ping().Result()
-	if err != nil {
-		L.Error(err)
-	} else {
-		L.Info("redis connect ping response:", pong)
-		global.GVA_REDIS = client
-	}
-}

+ 5 - 5
server/init/regist_table.go → server/initialize/db_table.go

@@ -1,15 +1,15 @@
-package init
+package initialize
 
 
 import (
 import (
+	"gin-vue-admin/global"
 	"gin-vue-admin/model"
 	"gin-vue-admin/model"
-	"github.com/jinzhu/gorm"
 )
 )
 
 
 //注册数据库表专用
 //注册数据库表专用
-func RegisterTable(db *gorm.DB) {
+func DBTables() {
+	db := global.GVA_DB
 	db.AutoMigrate(model.SysUser{},
 	db.AutoMigrate(model.SysUser{},
 		model.SysAuthority{},
 		model.SysAuthority{},
-		model.SysMenu{},
 		model.SysApi{},
 		model.SysApi{},
 		model.SysBaseMenu{},
 		model.SysBaseMenu{},
 		model.JwtBlacklist{},
 		model.JwtBlacklist{},
@@ -20,5 +20,5 @@ func RegisterTable(db *gorm.DB) {
 		model.ExaFileChunk{},
 		model.ExaFileChunk{},
 		model.ExaCustomer{},
 		model.ExaCustomer{},
 	)
 	)
-	L.Debug("register table success")
+	global.GVA_LOG.Debug("register table success")
 }
 }

+ 4 - 3
server/init/mysql.go → server/initialize/mysql.go

@@ -1,4 +1,4 @@
-package init
+package initialize
 
 
 import (
 import (
 	"gin-vue-admin/global"
 	"gin-vue-admin/global"
@@ -7,9 +7,10 @@ import (
 )
 )
 
 
 //初始化数据库并产生数据库全局变量
 //初始化数据库并产生数据库全局变量
-func RegisterMysql(admin MysqlAdmin) {
+func Mysql() {
+	admin := global.GVA_CONFIG.Mysql
 	if db, err := gorm.Open("mysql", admin.Username+":"+admin.Password+"@("+admin.Path+")/"+admin.Dbname+"?"+admin.Config); err != nil {
 	if db, err := gorm.Open("mysql", admin.Username+":"+admin.Password+"@("+admin.Path+")/"+admin.Dbname+"?"+admin.Config); err != nil {
-		L.Error("DEFAULTDB数据库启动异常", err)
+		global.GVA_LOG.Error("DEFAULTDB数据库启动异常", err)
 	} else {
 	} else {
 		global.GVA_DB = db
 		global.GVA_DB = db
 		global.GVA_DB.DB().SetMaxIdleConns(admin.MaxIdleConns)
 		global.GVA_DB.DB().SetMaxIdleConns(admin.MaxIdleConns)

+ 22 - 0
server/initialize/redis.go

@@ -0,0 +1,22 @@
+package initialize
+
+import (
+	"gin-vue-admin/global"
+	"github.com/go-redis/redis"
+)
+
+func Redis() {
+	redisCfg := global.GVA_CONFIG.Redis
+	client := redis.NewClient(&redis.Options{
+		Addr:     redisCfg.Addr,
+		Password: redisCfg.Password, // no password set
+		DB:       redisCfg.DB,       // use default DB
+	})
+	pong, err := client.Ping().Result()
+	if err != nil {
+		global.GVA_LOG.Error(err)
+	} else {
+		global.GVA_LOG.Info("redis connect ping response:", pong)
+		global.GVA_REDIS = client
+	}
+}

+ 7 - 8
server/init/router.go → server/initialize/router.go

@@ -1,7 +1,8 @@
-package init
+package initialize
 
 
 import (
 import (
 	_ "gin-vue-admin/docs"
 	_ "gin-vue-admin/docs"
+	"gin-vue-admin/global"
 	"gin-vue-admin/middleware"
 	"gin-vue-admin/middleware"
 	"gin-vue-admin/router"
 	"gin-vue-admin/router"
 	"github.com/gin-gonic/gin"
 	"github.com/gin-gonic/gin"
@@ -10,18 +11,16 @@ import (
 )
 )
 
 
 //初始化总路由
 //初始化总路由
-func RegisterRouter() *gin.Engine {
+func Routers() *gin.Engine {
 	var Router = gin.Default()
 	var Router = gin.Default()
 
 
 	//Router.Use(middleware.LoadTls())  // 打开就能玩https了
 	//Router.Use(middleware.LoadTls())  // 打开就能玩https了
-	// 如果不需要日志 请关闭这里
-	Router.Use(middleware.Logger())
-	L.Debug("use middleware logger")
+	global.GVA_LOG.Debug("use middleware logger")
 	// 跨域
 	// 跨域
 	Router.Use(middleware.Cors())
 	Router.Use(middleware.Cors())
-	L.Debug("use middleware cors")
+	global.GVA_LOG.Debug("use middleware cors")
 	Router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
 	Router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
-	L.Debug("register swagger handler")
+	global.GVA_LOG.Debug("register swagger handler")
 	// 方便统一添加路由组前缀 多服务器上线使用
 	// 方便统一添加路由组前缀 多服务器上线使用
 	ApiGroup := Router.Group("")
 	ApiGroup := Router.Group("")
 	router.InitUserRouter(ApiGroup)                  // 注册用户路由
 	router.InitUserRouter(ApiGroup)                  // 注册用户路由
@@ -36,6 +35,6 @@ func RegisterRouter() *gin.Engine {
 	router.InitSystemRouter(ApiGroup)                // system相关路由
 	router.InitSystemRouter(ApiGroup)                // system相关路由
 	router.InitCustomerRouter(ApiGroup)              // 客户路由
 	router.InitCustomerRouter(ApiGroup)              // 客户路由
 	router.InitAutoCodeRouter(ApiGroup)              // 创建自动化代码
 	router.InitAutoCodeRouter(ApiGroup)              // 创建自动化代码
-	L.Info("router register success")
+	global.GVA_LOG.Info("router register success")
 	return Router
 	return Router
 }
 }

+ 3 - 27
server/main.go

@@ -3,37 +3,13 @@ package main
 import (
 import (
 	"gin-vue-admin/core"
 	"gin-vue-admin/core"
 	"gin-vue-admin/global"
 	"gin-vue-admin/global"
-	"gin-vue-admin/init"
-	"gin-vue-admin/init/qmlog"
-	"os"
+	"gin-vue-admin/initialize"
 	//"runtime"
 	//"runtime"
 )
 )
 
 
-// @title Swagger Example API
-// @version 0.0.1
-// @description This is a sample Server pets
-// @securityDefinitions.apikey ApiKeyAuth
-// @in header
-// @name x-token
-// @BasePath /
-
-var (
-	mysqlHost = os.Getenv("MYSQLHOST")
-	mysqlPort = os.Getenv("MYSQLPORT")
-)
-
 func main() {
 func main() {
-	if err := qmlog.NewLogger(); err != nil {
-		panic(err)
-	}
-	// 可以通过环境变量来覆盖配置值
-	// 未设定有效的环境变量时,使用配置值
-	mysqlConfig := init.GinVueAdminconfig.MysqlAdmin
-	// 链接初始化数据库
-	init.RegisterMysql(mysqlConfig) // 链接初始化数据库
-
-	// 注册数据库表
-	init.RegisterTable(global.GVA_DB)
+	initialize.Mysql()
+	initialize.DBTables()
 	// 程序结束前关闭数据库链接
 	// 程序结束前关闭数据库链接
 	defer global.GVA_DB.Close()
 	defer global.GVA_DB.Close()
 
 

+ 0 - 64
server/middleware/logger.go

@@ -1,64 +0,0 @@
-package middleware
-
-import (
-	"bytes"
-	"gin-vue-admin/init"
-	"net/http/httputil"
-	"strings"
-	"time"
-
-	"github.com/gin-gonic/gin"
-)
-
-func Logger() gin.HandlerFunc {
-	return func(c *gin.Context) {
-		// request time
-		start := time.Now()
-		// request path
-		path := c.Request.URL.Path
-		logFlag := true
-		if strings.Contains(path, "swagger") {
-			logFlag = false
-		}
-		// request ip
-		clientIP := c.ClientIP()
-		// method
-		method := c.Request.Method
-		// copy request content
-		req, _ := httputil.DumpRequest(c.Request, true)
-		if logFlag {
-			init.L.Debug(
-				"Request:", method, clientIP, path, string(req))
-		}
-		// replace writer
-		cusWriter := &responseBodyWriter{
-			ResponseWriter: c.Writer,
-			body:           bytes.NewBufferString(""),
-		}
-		c.Writer = cusWriter
-		// handle request
-		c.Next()
-		// ending time
-		end := time.Now()
-		//execute time
-		latency := end.Sub(start)
-		statusCode := c.Writer.Status()
-		if logFlag {
-			init.L.Debug(
-				"Response:",
-				statusCode,
-				latency,
-				cusWriter.body.String())
-		}
-	}
-}
-
-type responseBodyWriter struct {
-	gin.ResponseWriter
-	body *bytes.Buffer
-}
-
-func (w responseBodyWriter) Write(b []byte) (int, error) {
-	w.body.Write(b)
-	return w.ResponseWriter.Write(b)
-}

+ 31 - 6
server/model/exa_breakpoint_continue.go

@@ -5,7 +5,7 @@ import (
 	"github.com/jinzhu/gorm"
 	"github.com/jinzhu/gorm"
 )
 )
 
 
-//文件结构体
+// file struct, 文件结构体
 type ExaFile struct {
 type ExaFile struct {
 	gorm.Model
 	gorm.Model
 	FileName     string
 	FileName     string
@@ -16,7 +16,7 @@ type ExaFile struct {
 	IsFinish     bool
 	IsFinish     bool
 }
 }
 
 
-//切片结构体
+// file chunk struct, 切片结构体
 type ExaFileChunk struct {
 type ExaFileChunk struct {
 	gorm.Model
 	gorm.Model
 	ExaFileId       uint
 	ExaFileId       uint
@@ -24,7 +24,13 @@ type ExaFileChunk struct {
 	FileChunkPath   string
 	FileChunkPath   string
 }
 }
 
 
-//文件合成完成
+// @title         FileCreateComplete
+// @description   file creation, 文件合成完成
+// @auth                     (2020/04/05  20:22 )
+// @param     FileMd5         string
+// @param     FileName        string
+// @param     FilePath        string
+// @return                    error
 func (f *ExaFile) FileCreateComplete(FileMd5 string, FileName string, FilePath string) error {
 func (f *ExaFile) FileCreateComplete(FileMd5 string, FileName string, FilePath string) error {
 	var file ExaFile
 	var file ExaFile
 	upDateFile := make(map[string]interface{})
 	upDateFile := make(map[string]interface{})
@@ -34,7 +40,15 @@ func (f *ExaFile) FileCreateComplete(FileMd5 string, FileName string, FilePath s
 	return err
 	return err
 }
 }
 
 
-//第一次上传或者断点续传时候检测当前文件属性,没有则创建,有则返回文件的当前切片
+// @title         FindOrCreateFile
+// @description   Check your file if it does not exist, or return current slice of the file
+// 上传文件时检测当前文件属性,如果没有文件则创建,有则返回文件的当前切片
+// @auth                     (2020/04/05  20:22 )
+// @param     FileMd5         string
+// @param     FileName        string
+// @param     ChunkTotal      int
+// @return    err             error
+// @return    file            ExaFile
 func (f *ExaFile) FindOrCreateFile(FileMd5 string, FileName string, ChunkTotal int) (err error, file ExaFile) {
 func (f *ExaFile) FindOrCreateFile(FileMd5 string, FileName string, ChunkTotal int) (err error, file ExaFile) {
 	var cfile ExaFile
 	var cfile ExaFile
 	cfile.FileMd5 = FileMd5
 	cfile.FileMd5 = FileMd5
@@ -52,7 +66,12 @@ func (f *ExaFile) FindOrCreateFile(FileMd5 string, FileName string, ChunkTotal i
 	}
 	}
 }
 }
 
 
-// 创建文件切片记录
+// @title    CreateFileChunk
+// @description   create a chunk of the file, 创建文件切片记录
+// @auth                       (2020/04/05  20:22 )
+// @param     FileChunkPath     string
+// @param     FileChunkNumber   int
+// @return                      error
 func (f *ExaFile) CreateFileChunk(FileChunkPath string, FileChunkNumber int) error {
 func (f *ExaFile) CreateFileChunk(FileChunkPath string, FileChunkNumber int) error {
 	var chunk ExaFileChunk
 	var chunk ExaFileChunk
 	chunk.FileChunkPath = FileChunkPath
 	chunk.FileChunkPath = FileChunkPath
@@ -62,7 +81,13 @@ func (f *ExaFile) CreateFileChunk(FileChunkPath string, FileChunkNumber int) err
 	return err
 	return err
 }
 }
 
 
-// 删除文件切片记录
+// @title    DeleteFileChunk
+// @description   delete a chuck of the file, 删除文件切片记录
+// @auth                     (2020/04/05  20:22 )
+// @param     FileMd5         string
+// @param     FileName        string
+// @param     FilePath        string
+// @return                    error
 func (f *ExaFile) DeleteFileChunk(fileMd5 string, fileName string, filePath string) error {
 func (f *ExaFile) DeleteFileChunk(fileMd5 string, fileName string, filePath string) error {
 	var chunks []ExaFileChunk
 	var chunks []ExaFileChunk
 	var file ExaFile
 	var file ExaFile

+ 22 - 6
server/model/exa_customer.go

@@ -14,32 +14,48 @@ type ExaCustomer struct {
 	SysUser            SysUser `json:"sysUser"`
 	SysUser            SysUser `json:"sysUser"`
 }
 }
 
 
-//创建用户
+// @title    CreateExaCustomer
+// @description   create a customer, 创建用户
+// @auth                     (2020/04/05  20:22 )
+// @return    err             error
 func (e *ExaCustomer) CreateExaCustomer() (err error) {
 func (e *ExaCustomer) CreateExaCustomer() (err error) {
 	err = global.GVA_DB.Create(e).Error
 	err = global.GVA_DB.Create(e).Error
 	return err
 	return err
 }
 }
 
 
-//删除用户
+// @title    DeleteFileChunk
+// @description   delete a customer, 删除用户
+// @auth                     (2020/04/05  20:22 )
+// @return                    error
 func (e *ExaCustomer) DeleteExaCustomer() (err error) {
 func (e *ExaCustomer) DeleteExaCustomer() (err error) {
 	err = global.GVA_DB.Delete(e).Error
 	err = global.GVA_DB.Delete(e).Error
 	return err
 	return err
 }
 }
 
 
-//更新用户
+// @title    UpdateExaCustomer
+// @description   update a customer, 更新用户
+// @auth                     (2020/04/05  20:22 )
+// @return                    error
 func (e *ExaCustomer) UpdateExaCustomer() (err error) {
 func (e *ExaCustomer) UpdateExaCustomer() (err error) {
 	err = global.GVA_DB.Save(e).Error
 	err = global.GVA_DB.Save(e).Error
 	return err
 	return err
 }
 }
 
 
-//获取用户信息
+// @title    GetExaCustomer
+// @description   get the info of a costumer , 获取用户信息
+// @auth                     (2020/04/05  20:22 )
+// @return                    error
+// @return    customer        ExaCustomer
 func (e *ExaCustomer) GetExaCustomer() (err error, customer ExaCustomer) {
 func (e *ExaCustomer) GetExaCustomer() (err error, customer ExaCustomer) {
 	err = global.GVA_DB.Where("id = ?", e.ID).First(&customer).Error
 	err = global.GVA_DB.Where("id = ?", e.ID).First(&customer).Error
 	return
 	return
 }
 }
 
 
-//获取用户列表
-// 分页获取数据
+// @title    GetInfoList
+// @description   get customer list by pagination, 分页获取用户列表
+// @auth                     (2020/04/05  20:22 )
+// @param     info            PageInfo
+// @return                    error
 func (e *ExaCustomer) GetInfoList(info PageInfo) (err error, list interface{}, total int) {
 func (e *ExaCustomer) GetInfoList(info PageInfo) (err error, list interface{}, total int) {
 	limit := info.PageSize
 	limit := info.PageSize
 	offset := info.PageSize * (info.Page - 1)
 	offset := info.PageSize * (info.Page - 1)

+ 19 - 1
server/model/exa_file_upload_download.go

@@ -13,23 +13,41 @@ type ExaFileUploadAndDownload struct {
 	Key  string `json:"key"`
 	Key  string `json:"key"`
 }
 }
 
 
+// @title    Upload
+// @description   删除文件切片记录
+// @auth                     (2020/04/05  20:22 )
+// @return                    error
 func (f *ExaFileUploadAndDownload) Upload() error {
 func (f *ExaFileUploadAndDownload) Upload() error {
 	err := global.GVA_DB.Create(f).Error
 	err := global.GVA_DB.Create(f).Error
 	return err
 	return err
 }
 }
 
 
+// @title    DeleteFile
+// @description   删除文件切片记录
+// @auth                     (2020/04/05  20:22 )
+// @return                    error
 func (f *ExaFileUploadAndDownload) DeleteFile() error {
 func (f *ExaFileUploadAndDownload) DeleteFile() error {
 	err := global.GVA_DB.Where("id = ?", f.ID).Unscoped().Delete(f).Error
 	err := global.GVA_DB.Where("id = ?", f.ID).Unscoped().Delete(f).Error
 	return err
 	return err
 }
 }
 
 
+// @title    FindFile
+// @description   删除文件切片记录
+// @auth                     (2020/04/05  20:22 )
+// @return                    error
 func (f *ExaFileUploadAndDownload) FindFile() (error, ExaFileUploadAndDownload) {
 func (f *ExaFileUploadAndDownload) FindFile() (error, ExaFileUploadAndDownload) {
 	var file ExaFileUploadAndDownload
 	var file ExaFileUploadAndDownload
 	err := global.GVA_DB.Where("id = ?", f.ID).First(&file).Error
 	err := global.GVA_DB.Where("id = ?", f.ID).First(&file).Error
 	return err, file
 	return err, file
 }
 }
 
 
-// 分页获取数据
+// @title    GetInfoList
+// @description   分页获取数据
+// @auth                     (2020/04/05  20:22 )
+// @param     info            PageInfo
+// @return    err             error
+// @return    list            error
+// @return    total           error
 func (f *ExaFileUploadAndDownload) GetInfoList(info PageInfo) (err error, list interface{}, total int) {
 func (f *ExaFileUploadAndDownload) GetInfoList(info PageInfo) (err error, list interface{}, total int) {
 	limit := info.PageSize
 	limit := info.PageSize
 	offset := info.PageSize * (info.Page - 1)
 	offset := info.PageSize * (info.Page - 1)

+ 43 - 8
server/model/sys_api.go

@@ -14,7 +14,22 @@ type SysApi struct {
 	Method      string `json:"method" gorm:"default:'POST'"`
 	Method      string `json:"method" gorm:"default:'POST'"`
 }
 }
 
 
-//新增基础api
+type CreateApiParams struct {
+	Path        string `json:"path"`
+	Description string `json:"description"`
+}
+
+type DeleteApiParams struct {
+	ID uint `json:"id"`
+}
+
+// @title    CreateApi
+// @description   create base apis, 新增基础api
+// @auth                     (2020/04/05  20:22 )
+// @param     FileMd5         string
+// @param     FileName        string
+// @param     FilePath        string
+// @return                    error
 func (a *SysApi) CreateApi() (err error) {
 func (a *SysApi) CreateApi() (err error) {
 	findOne := global.GVA_DB.Where("path = ?", a.Path).Find(&SysApi{}).Error
 	findOne := global.GVA_DB.Where("path = ?", a.Path).Find(&SysApi{}).Error
 	if findOne == nil {
 	if findOne == nil {
@@ -25,14 +40,20 @@ func (a *SysApi) CreateApi() (err error) {
 	return err
 	return err
 }
 }
 
 
-//删除基础api
+// @title    DeleteApi
+// @description   delete base apis, 删除基础api
+// @auth                     (2020/04/05  20:22 )
+// @return                    error
 func (a *SysApi) DeleteApi() (err error) {
 func (a *SysApi) DeleteApi() (err error) {
 	err = global.GVA_DB.Delete(a).Error
 	err = global.GVA_DB.Delete(a).Error
-	new(CasbinModel).clearCasbin(1, a.Path)
+	new(CasbinModel).ClearCasbin(1, a.Path)
 	return err
 	return err
 }
 }
 
 
-//更新api
+// @title    UpdateApi
+// @description   update a base api, update api
+// @auth                     (2020/04/05  20:22 )
+// @return                    error
 func (a *SysApi) UpdateApi() (err error) {
 func (a *SysApi) UpdateApi() (err error) {
 	var oldA SysApi
 	var oldA SysApi
 	flag := global.GVA_DB.Where("path = ?", a.Path).Find(&SysApi{}).RecordNotFound()
 	flag := global.GVA_DB.Where("path = ?", a.Path).Find(&SysApi{}).RecordNotFound()
@@ -43,7 +64,7 @@ func (a *SysApi) UpdateApi() (err error) {
 	if err != nil {
 	if err != nil {
 		return err
 		return err
 	} else {
 	} else {
-		err = new(CasbinModel).CasbinApiUpdate(oldA.Path, a.Path)
+		err = new(CasbinModel).UpdateCasbinApi(oldA.Path, a.Path)
 		if err != nil {
 		if err != nil {
 			return err
 			return err
 		} else {
 		} else {
@@ -53,19 +74,33 @@ func (a *SysApi) UpdateApi() (err error) {
 	return err
 	return err
 }
 }
 
 
-//获取选中角色所拥有的api
+// @title    GetApiById
+// @description   get the apis of the selected user, 获取选中角色所拥有的api
+// @auth                     (2020/04/05  20:22 )
+// @param     id              float64
+// @return                    error
 func (a *SysApi) GetApiById(id float64) (err error, api SysApi) {
 func (a *SysApi) GetApiById(id float64) (err error, api SysApi) {
 	err = global.GVA_DB.Where("id = ?", id).First(&api).Error
 	err = global.GVA_DB.Where("id = ?", id).First(&api).Error
 	return
 	return
 }
 }
 
 
-// 获取所有api信息
+// @title    GetAllApis
+// @description   get all apis, 获取所有的api
+// @auth                     (2020/04/05  20:22 )
+// @return       err          error
+// @return       apis         []SysApi
 func (a *SysApi) GetAllApis() (err error, apis []SysApi) {
 func (a *SysApi) GetAllApis() (err error, apis []SysApi) {
 	err = global.GVA_DB.Find(&apis).Error
 	err = global.GVA_DB.Find(&apis).Error
 	return
 	return
 }
 }
 
 
-// 分页获取数据
+// @title    GetInfoList
+// @description   get apis by pagination, 分页获取数据
+// @auth                     (2020/04/05  20:22 )
+// @param     info            PageInfo
+// @return    err             error
+// @return    list            interface{}
+// @return    total           int
 func (a *SysApi) GetInfoList(info PageInfo) (err error, list interface{}, total int) {
 func (a *SysApi) GetInfoList(info PageInfo) (err error, list interface{}, total int) {
 	limit := info.PageSize
 	limit := info.PageSize
 	offset := info.PageSize * (info.Page - 1)
 	offset := info.PageSize * (info.Page - 1)

+ 51 - 3
server/model/sys_authority.go

@@ -18,20 +18,33 @@ type SysAuthority struct {
 	SysBaseMenus    []SysBaseMenu  `json:"menus" gorm:"many2many:sys_authority_menus;"`
 	SysBaseMenus    []SysBaseMenu  `json:"menus" gorm:"many2many:sys_authority_menus;"`
 }
 }
 
 
-// 创建角色
+// @title    CreateAuthority
+// @description   create authority, 创建一个权限
+// @auth                     (2020/04/05  20:22 )
+// @param     FileMd5         string
+// @param     FileName        string
+// @param     FilePath        string
+// @return                    error
 func (a *SysAuthority) CreateAuthority() (err error, authority *SysAuthority) {
 func (a *SysAuthority) CreateAuthority() (err error, authority *SysAuthority) {
 	err = global.GVA_DB.Create(a).Error
 	err = global.GVA_DB.Create(a).Error
 	return err, a
 	return err, a
 }
 }
 
 
+// @title    DeleteAuthority
+// @description   删除文件切片记录
+// @auth                     (2020/04/05  20:22 )
+// @param     FileMd5         string
+// @param     FileName        string
+// @param     FilePath        string
+// @return                    error
 // 删除角色
 // 删除角色
 func (a *SysAuthority) DeleteAuthority() (err error) {
 func (a *SysAuthority) DeleteAuthority() (err error) {
 	err = global.GVA_DB.Where("authority_id = ?", a.AuthorityId).Find(&SysUser{}).Error
 	err = global.GVA_DB.Where("authority_id = ?", a.AuthorityId).Find(&SysUser{}).Error
 	if err != nil {
 	if err != nil {
 		err = global.GVA_DB.Where("parent_id = ?", a.AuthorityId).Find(&SysAuthority{}).Error
 		err = global.GVA_DB.Where("parent_id = ?", a.AuthorityId).Find(&SysAuthority{}).Error
 		if err != nil {
 		if err != nil {
-			err = global.GVA_DB.Where("authority_id = ?", a.AuthorityId).First(a).Unscoped().Delete(a).Error
-			new(CasbinModel).clearCasbin(0, a.AuthorityId)
+			err = global.GVA_DB.Preload("SysBaseMenus").Where("authority_id = ?", a.AuthorityId).First(a).Unscoped().Delete(a).Association("SysBaseMenus").Delete(a.SysBaseMenus).Error
+			new(CasbinModel).ClearCasbin(0, a.AuthorityId)
 		} else {
 		} else {
 			err = errors.New("此角色存在子角色不允许删除")
 			err = errors.New("此角色存在子角色不允许删除")
 		}
 		}
@@ -41,6 +54,13 @@ func (a *SysAuthority) DeleteAuthority() (err error) {
 	return err
 	return err
 }
 }
 
 
+// @title    GetInfoList
+// @description   删除文件切片记录
+// @auth                     (2020/04/05  20:22 )
+// @param     FileMd5         string
+// @param     FileName        string
+// @param     FilePath        string
+// @return                    error
 // 分页获取数据
 // 分页获取数据
 func (a *SysAuthority) GetInfoList(info PageInfo) (err error, list interface{}, total int) {
 func (a *SysAuthority) GetInfoList(info PageInfo) (err error, list interface{}, total int) {
 	limit := info.PageSize
 	limit := info.PageSize
@@ -60,6 +80,13 @@ func (a *SysAuthority) GetInfoList(info PageInfo) (err error, list interface{},
 	}
 	}
 }
 }
 
 
+// @title    findChildrenAuthority
+// @description   删除文件切片记录
+// @auth                     (2020/04/05  20:22 )
+// @param     FileMd5         string
+// @param     FileName        string
+// @param     FilePath        string
+// @return                    error
 func findChildrenAuthority(authority *SysAuthority) (err error) {
 func findChildrenAuthority(authority *SysAuthority) (err error) {
 	err = global.GVA_DB.Preload("DataAuthorityId").Where("parent_id = ?", authority.AuthorityId).Find(&authority.Children).Error
 	err = global.GVA_DB.Preload("DataAuthorityId").Where("parent_id = ?", authority.AuthorityId).Find(&authority.Children).Error
 	if len(authority.Children) > 0 {
 	if len(authority.Children) > 0 {
@@ -70,6 +97,13 @@ func findChildrenAuthority(authority *SysAuthority) (err error) {
 	return err
 	return err
 }
 }
 
 
+// @title    SetDataAuthority
+// @description   删除文件切片记录
+// @auth                     (2020/04/05  20:22 )
+// @param     FileMd5         string
+// @param     FileName        string
+// @param     FilePath        string
+// @return                    error
 func (a *SysAuthority) SetDataAuthority() error {
 func (a *SysAuthority) SetDataAuthority() error {
 	var s SysAuthority
 	var s SysAuthority
 	global.GVA_DB.Preload("DataAuthorityId").First(&s, "authority_id = ?", a.AuthorityId)
 	global.GVA_DB.Preload("DataAuthorityId").First(&s, "authority_id = ?", a.AuthorityId)
@@ -77,6 +111,13 @@ func (a *SysAuthority) SetDataAuthority() error {
 	return err
 	return err
 }
 }
 
 
+// @title    SetMuneAuthority
+// @description   删除文件切片记录
+// @auth                     (2020/04/05  20:22 )
+// @param     FileMd5         string
+// @param     FileName        string
+// @param     FilePath        string
+// @return                    error
 func (a *SysAuthority) SetMuneAuthority() error {
 func (a *SysAuthority) SetMuneAuthority() error {
 	var s SysAuthority
 	var s SysAuthority
 	global.GVA_DB.Preload("SysBaseMenus").First(&s, "authority_id = ?", a.AuthorityId)
 	global.GVA_DB.Preload("SysBaseMenus").First(&s, "authority_id = ?", a.AuthorityId)
@@ -84,6 +125,13 @@ func (a *SysAuthority) SetMuneAuthority() error {
 	return err
 	return err
 }
 }
 
 
+// @title    GetAuthorityInfo
+// @description   删除文件切片记录
+// @auth                     (2020/04/05  20:22 )
+// @param     FileMd5         string
+// @param     FileName        string
+// @param     FilePath        string
+// @return                    error
 func (a *SysAuthority) GetAuthorityInfo() (err error, sa SysAuthority) {
 func (a *SysAuthority) GetAuthorityInfo() (err error, sa SysAuthority) {
 	err = global.GVA_DB.Preload("DataAuthorityId").Where("authority_id = ?", a.AuthorityId).First(&sa).Error
 	err = global.GVA_DB.Preload("DataAuthorityId").Where("authority_id = ?", a.AuthorityId).First(&sa).Error
 	return err, sa
 	return err, sa

+ 38 - 28
server/model/sys_authority_menu.go

@@ -1,58 +1,68 @@
 package model
 package model
 
 
 import (
 import (
-	"fmt"
 	"gin-vue-admin/global"
 	"gin-vue-admin/global"
 )
 )
 
 
-// menu需要构建的点有点多 这里关联关系表直接把所有数据拿过来 用代码实现关联  后期实现主外键模式
 type SysMenu struct {
 type SysMenu struct {
 	SysBaseMenu
 	SysBaseMenu
-	MenuId      string    `json:"menuId"`
+	MenuId      string    `json:"MenuId"`
 	AuthorityId string    `json:"-"`
 	AuthorityId string    `json:"-"`
 	Children    []SysMenu `json:"children"`
 	Children    []SysMenu `json:"children"`
 }
 }
 
 
-// 为角色增加menu树
+// @title    AddMenuAuthority
+// @description   为角色增加menu树
+// @auth                     (2020/04/05  20:22 )
+// @param     menus           []SysBaseMenu
+// @param     authorityId     string
+// @return                    error
 func (m *SysMenu) AddMenuAuthority(menus []SysBaseMenu, authorityId string) (err error) {
 func (m *SysMenu) AddMenuAuthority(menus []SysBaseMenu, authorityId string) (err error) {
-	var menu SysMenu
-	global.GVA_DB.Where("authority_id = ? ", authorityId).Unscoped().Delete(&SysMenu{})
-	for _, v := range menus {
-		menu.SysBaseMenu = v
-		menu.AuthorityId = authorityId
-		menu.MenuId = fmt.Sprintf("%v", v.ID)
-		menu.ID = 0
-		err = global.GVA_DB.Create(&menu).Error
-		if err != nil {
-			return err
-		}
-	}
 	var auth SysAuthority
 	var auth SysAuthority
 	auth.AuthorityId = authorityId
 	auth.AuthorityId = authorityId
 	auth.SysBaseMenus = menus
 	auth.SysBaseMenus = menus
-	auth.SetMuneAuthority()
-	return nil
+	err = auth.SetMuneAuthority()
+	return err
 }
 }
 
 
-// 查看当前角色树
-func (m *SysMenu) GetMenuAuthority(authorityId string) (err error, menus []SysMenu) {
-	err = global.GVA_DB.Where("authority_id = ?", authorityId).Find(&menus).Error
-	return err, menus
+// @title    GetMenuAuthority
+// @description   查看当前角色树
+// @auth                     (2020/04/05  20:22 )
+// @param     authorityId     string
+// @return    err             error
+// @return    menus           []SysBaseMenu
+func (m *SysMenu) GetMenuAuthority(authorityId string) (err error, menus []SysBaseMenu) {
+	var a SysAuthority
+	err = global.GVA_DB.Preload("SysBaseMenus").Where("authority_id = ?", authorityId).First(&a).Error
+	return err, a.SysBaseMenus
 }
 }
 
 
-//获取动态路由树
+// @title    GetMenuTree
+// @description   获取动态菜单树
+// @auth                     (2020/04/05  20:22 )
+// @param     authorityId     string
+// @return    err             error
+// @return    menus           []SysMenu
 func (m *SysMenu) GetMenuTree(authorityId string) (err error, menus []SysMenu) {
 func (m *SysMenu) GetMenuTree(authorityId string) (err error, menus []SysMenu) {
-	err = global.GVA_DB.Where("authority_id = ? AND parent_id = ?", authorityId, 0).Order("sort", true).Find(&menus).Error
+	SQLstatement := "SELECT authority_menu.created_at,authority_menu.updated_at,authority_menu.deleted_at,authority_menu.menu_level,authority_menu.parent_id,authority_menu.path,authority_menu.`name`,authority_menu.hidden,authority_menu.component,authority_menu.title,authority_menu.icon,authority_menu.sort,authority_menu.menu_id,authority_menu.authority_id FROM authority_menu WHERE authority_menu.authority_id = ? AND authority_menu.parent_id = ?"
+
+	err = global.GVA_DB.Raw(SQLstatement, authorityId, 0).Scan(&menus).Error
 	for i := 0; i < len(menus); i++ {
 	for i := 0; i < len(menus); i++ {
-		err = getChildrenList(&menus[i])
+		err = getChildrenList(&menus[i], SQLstatement)
 	}
 	}
 	return err, menus
 	return err, menus
 }
 }
 
 
-func getChildrenList(menu *SysMenu) (err error) {
-	err = global.GVA_DB.Where("authority_id = ? AND parent_id = ?", menu.AuthorityId, menu.MenuId).Order("sort", true).Find(&menu.Children).Error
+// @title    getChildrenList
+// @description   获取子菜单
+// @auth                     (2020/04/05  20:22 )
+// @param     menu            *SysMenu
+// @param     SQLstatement    string
+// @return    err             error
+func getChildrenList(menu *SysMenu, SQLstatement string) (err error) {
+	err = global.GVA_DB.Raw(SQLstatement, menu.AuthorityId, menu.MenuId).Scan(&menu.Children).Error
 	for i := 0; i < len(menu.Children); i++ {
 	for i := 0; i < len(menu.Children); i++ {
-		err = getChildrenList(&menu.Children[i])
+		err = getChildrenList(&menu.Children[i], SQLstatement)
 	}
 	}
 	return err
 	return err
 }
 }

+ 9 - 1
server/model/sys_auto_code.go

@@ -21,6 +21,10 @@ type Field struct {
 	ColumnName string `json:"columnName"`
 	ColumnName string `json:"columnName"`
 }
 }
 
 
+// @title    CreateTemp
+// @description   函数的详细描述
+// @auth                     (2020/04/05  20:22 )
+// @return    err             error
 func (a *AutoCodeStruct) CreateTemp() (err error) {
 func (a *AutoCodeStruct) CreateTemp() (err error) {
 	basePath := "./template"
 	basePath := "./template"
 	modelTmpl, err := template.ParseFiles(basePath + "/te/model.go.tpl")
 	modelTmpl, err := template.ParseFiles(basePath + "/te/model.go.tpl")
@@ -125,7 +129,11 @@ func (a *AutoCodeStruct) CreateTemp() (err error) {
 	return nil
 	return nil
 }
 }
 
 
-//批量创建文件夹
+// @title    createDir
+// @description   批量创建文件夹
+// @auth                     (2020/04/05  20:22 )
+// @param     dirs            string
+// @return    err             error
 func createDir(dirs ...string) (err error) {
 func createDir(dirs ...string) (err error) {
 	for _, v := range dirs {
 	for _, v := range dirs {
 		exist, err := utils.PathExists(v)
 		exist, err := utils.PathExists(v)

+ 36 - 10
server/model/sys_base_menu.go

@@ -17,7 +17,6 @@ type SysBaseMenu struct {
 	Component     string `json:"component"`
 	Component     string `json:"component"`
 	Sort          string `json:"sort"`
 	Sort          string `json:"sort"`
 	Meta          `json:"meta"`
 	Meta          `json:"meta"`
-	NickName      string         `json:"nickName"`
 	SysAuthoritys []SysAuthority `json:"authoritys" gorm:"many2many:sys_authority_menus;"`
 	SysAuthoritys []SysAuthority `json:"authoritys" gorm:"many2many:sys_authority_menus;"`
 	Children      []SysBaseMenu  `json:"children"`
 	Children      []SysBaseMenu  `json:"children"`
 }
 }
@@ -27,11 +26,15 @@ type Meta struct {
 	Icon  string `json:"icon"`
 	Icon  string `json:"icon"`
 }
 }
 
 
+// @title    AddBaseMenu
+// @description   函数的详细描述
+// @auth                     (2020/04/05  20:22 )
+// @param     newPassword     string
+// @return    err             error
 //增加基础路由
 //增加基础路由
 func (b *SysBaseMenu) AddBaseMenu() (err error) {
 func (b *SysBaseMenu) AddBaseMenu() (err error) {
 	findOne := global.GVA_DB.Where("name = ?", b.Name).Find(&SysBaseMenu{}).Error
 	findOne := global.GVA_DB.Where("name = ?", b.Name).Find(&SysBaseMenu{}).Error
 	if findOne != nil {
 	if findOne != nil {
-		b.NickName = b.Title
 		err = global.GVA_DB.Create(b).Error
 		err = global.GVA_DB.Create(b).Error
 	} else {
 	} else {
 		err = errors.New("存在重复name,请修改name")
 		err = errors.New("存在重复name,请修改name")
@@ -39,19 +42,26 @@ func (b *SysBaseMenu) AddBaseMenu() (err error) {
 	return err
 	return err
 }
 }
 
 
-//删除基础路由
+// @title    DeleteBaseMenu
+// @description   删除基础路由
+// @auth                     (2020/04/05  20:22 )
+// @param     newPassword     string
+// @return    err             error
 func (b *SysBaseMenu) DeleteBaseMenu(id float64) (err error) {
 func (b *SysBaseMenu) DeleteBaseMenu(id float64) (err error) {
 	err = global.GVA_DB.Where("parent_id = ?", id).First(&SysBaseMenu{}).Error
 	err = global.GVA_DB.Where("parent_id = ?", id).First(&SysBaseMenu{}).Error
 	if err != nil {
 	if err != nil {
-		err = global.GVA_DB.Where("id = ?", id).Delete(&b).Error
-		err = global.GVA_DB.Where("menu_id = ?", id).Unscoped().Delete(&SysMenu{}).Error
+		err = global.GVA_DB.Preload("SysAuthoritys").Where("id = ?", id).Delete(&b).Association("SysAuthoritys").Delete(b.SysAuthoritys).Error
 	} else {
 	} else {
 		return errors.New("此菜单存在子菜单不可删除")
 		return errors.New("此菜单存在子菜单不可删除")
 	}
 	}
 	return err
 	return err
 }
 }
 
 
-//更新路由
+// @title    UpdateBaseMenu
+// @description   更新路由
+// @auth                     (2020/04/05  20:22 )
+// @param     newPassword     string
+// @return    err             error
 func (b *SysBaseMenu) UpdateBaseMenu() (err error) {
 func (b *SysBaseMenu) UpdateBaseMenu() (err error) {
 	upDateMap := make(map[string]interface{})
 	upDateMap := make(map[string]interface{})
 	upDateMap["parent_id"] = b.ParentId
 	upDateMap["parent_id"] = b.ParentId
@@ -62,20 +72,27 @@ func (b *SysBaseMenu) UpdateBaseMenu() (err error) {
 	upDateMap["title"] = b.Title
 	upDateMap["title"] = b.Title
 	upDateMap["icon"] = b.Icon
 	upDateMap["icon"] = b.Icon
 	upDateMap["sort"] = b.Sort
 	upDateMap["sort"] = b.Sort
-	upDateMap["nick_name"] = b.Title
 	err = global.GVA_DB.Where("id = ?", b.ID).Find(&SysBaseMenu{}).Updates(upDateMap).Error
 	err = global.GVA_DB.Where("id = ?", b.ID).Find(&SysBaseMenu{}).Updates(upDateMap).Error
 	err1 := global.GVA_DB.Where("menu_id = ?", b.ID).Find(&[]SysMenu{}).Updates(upDateMap).Error
 	err1 := global.GVA_DB.Where("menu_id = ?", b.ID).Find(&[]SysMenu{}).Updates(upDateMap).Error
 	fmt.Printf("菜单修改时候,关联菜单err1:%v,err:%v", err1, err)
 	fmt.Printf("菜单修改时候,关联菜单err1:%v,err:%v", err1, err)
 	return err
 	return err
 }
 }
 
 
-//当前选中角色所拥有的路由
+// @title    GetBaseMenuById
+// @description   get current menus, 返回当前选中menu
+// @auth                     (2020/04/05  20:22 )
+// @param     newPassword     string
+// @return    err             error
 func (b *SysBaseMenu) GetBaseMenuById(id float64) (err error, menu SysBaseMenu) {
 func (b *SysBaseMenu) GetBaseMenuById(id float64) (err error, menu SysBaseMenu) {
 	err = global.GVA_DB.Where("id = ?", id).First(&menu).Error
 	err = global.GVA_DB.Where("id = ?", id).First(&menu).Error
 	return
 	return
 }
 }
 
 
-//获取路由分页
+// @title    GetInfoList
+// @description   获取路由分页
+// @auth                     (2020/04/05  20:22 )
+// @param     newPassword     string
+// @return    err             error
 func (b *SysBaseMenu) GetInfoList(info PageInfo) (err error, list interface{}, total int) {
 func (b *SysBaseMenu) GetInfoList(info PageInfo) (err error, list interface{}, total int) {
 	limit := info.PageSize
 	limit := info.PageSize
 	offset := info.PageSize * (info.Page - 1)
 	offset := info.PageSize * (info.Page - 1)
@@ -92,7 +109,11 @@ func (b *SysBaseMenu) GetInfoList(info PageInfo) (err error, list interface{}, t
 	}
 	}
 }
 }
 
 
-//获取基础路由树
+// @title    GetBaseMenuTree
+// @description   获取基础路由树
+// @auth                     (2020/04/05  20:22 )
+// @return    err              error
+// @return    menus            []SysBaseMenu
 func (m *SysBaseMenu) GetBaseMenuTree() (err error, menus []SysBaseMenu) {
 func (m *SysBaseMenu) GetBaseMenuTree() (err error, menus []SysBaseMenu) {
 	err = global.GVA_DB.Where(" parent_id = ?", 0).Order("sort", true).Find(&menus).Error
 	err = global.GVA_DB.Where(" parent_id = ?", 0).Order("sort", true).Find(&menus).Error
 	for i := 0; i < len(menus); i++ {
 	for i := 0; i < len(menus); i++ {
@@ -101,6 +122,11 @@ func (m *SysBaseMenu) GetBaseMenuTree() (err error, menus []SysBaseMenu) {
 	return err, menus
 	return err, menus
 }
 }
 
 
+// @title    getBaseChildrenList
+// @description   get children of menu, 获取菜单的子菜单
+// @auth                     (2020/04/05  20:22 )
+// @param     menu            *SysBaseMenu
+// @return    err             error
 func getBaseChildrenList(menu *SysBaseMenu) (err error) {
 func getBaseChildrenList(menu *SysBaseMenu) (err error) {
 	err = global.GVA_DB.Where("parent_id = ?", menu.ID).Order("sort", true).Find(&menu.Children).Error
 	err = global.GVA_DB.Where("parent_id = ?", menu.ID).Order("sort", true).Find(&menu.Children).Error
 	for i := 0; i < len(menu.Children); i++ {
 	for i := 0; i < len(menu.Children); i++ {

+ 52 - 17
server/model/sys_casbin.go

@@ -29,14 +29,19 @@ type CasbinInReceive struct {
 	CasbinInfos []CasbinInfo `json:"casbinInfos"`
 	CasbinInfos []CasbinInfo `json:"casbinInfos"`
 }
 }
 
 
-// 更新权限
-func (c *CasbinModel) CasbinPUpdate(AuthorityId string, casbinInfos []CasbinInfo) error {
-	c.clearCasbin(0, AuthorityId)
+// @title    UpdateCasbin
+// @description   update casbin authority, 更新casbin权限
+// @auth                     (2020/04/05  20:22 )
+// @param     authorityId      string
+// @param     casbinInfos      []CasbinInfo
+// @return                     error
+func (c *CasbinModel) UpdateCasbin(authorityId string, casbinInfos []CasbinInfo) error {
+	c.ClearCasbin(0, authorityId)
 	for _, v := range casbinInfos {
 	for _, v := range casbinInfos {
 		cm := CasbinModel{
 		cm := CasbinModel{
 			ID:          0,
 			ID:          0,
 			Ptype:       "p",
 			Ptype:       "p",
-			AuthorityId: AuthorityId,
+			AuthorityId: authorityId,
 			Path:        v.Path,
 			Path:        v.Path,
 			Method:      v.Method,
 			Method:      v.Method,
 		}
 		}
@@ -48,45 +53,73 @@ func (c *CasbinModel) CasbinPUpdate(AuthorityId string, casbinInfos []CasbinInfo
 	return nil
 	return nil
 }
 }
 
 
-// API更新随动
-func (c *CasbinModel) CasbinApiUpdate(oldPath string, newPath string) error {
+// @title    UpdateCasbinApi
+// @description   update casbin apis, API更新随动
+// @auth                     (2020/04/05  20:22 )
+// @param     oldPath          string
+// @param     newPath          string
+// @return                     error
+func (c *CasbinModel) UpdateCasbinApi(oldPath string, newPath string) error {
 	var cs []CasbinModel
 	var cs []CasbinModel
 	err := global.GVA_DB.Table("casbin_rule").Where("v1 = ?", oldPath).Find(&cs).Update("v1", newPath).Error
 	err := global.GVA_DB.Table("casbin_rule").Where("v1 = ?", oldPath).Find(&cs).Update("v1", newPath).Error
 	return err
 	return err
 }
 }
 
 
-//添加权限
+// @title    AddCasbin
+// @description   add casbin authority, 添加权限
+// @auth                     (2020/04/05  20:22 )
+// @param     cm              CasbinModel
+// @return                    bool
 func (c *CasbinModel) AddCasbin(cm CasbinModel) bool {
 func (c *CasbinModel) AddCasbin(cm CasbinModel) bool {
 	e := Casbin()
 	e := Casbin()
 	return e.AddPolicy(cm.AuthorityId, cm.Path, cm.Method)
 	return e.AddPolicy(cm.AuthorityId, cm.Path, cm.Method)
 }
 }
 
 
-//获取权限列表
-func (c *CasbinModel) GetPolicyPathByAuthorityId(AuthorityId string) []string {
+// @title    GetPolicyPathByAuthorityId
+// @description   get policy path by authorityId, 获取权限列表
+// @auth                     (2020/04/05  20:22 )
+// @param     authorityId     string
+// @return                    []string
+func (c *CasbinModel) GetPolicyPathByAuthorityId(authorityId string) []string {
 	e := Casbin()
 	e := Casbin()
 	var pathList []string
 	var pathList []string
-	list := e.GetFilteredPolicy(0, AuthorityId)
+	list := e.GetFilteredPolicy(0, authorityId)
 	for _, v := range list {
 	for _, v := range list {
 		pathList = append(pathList, v[1])
 		pathList = append(pathList, v[1])
 	}
 	}
 	return pathList
 	return pathList
 }
 }
 
 
-//清除匹配的权限
-func (c *CasbinModel) clearCasbin(v int, p string) bool {
+// @title    ClearCasbin
+// @description   清除匹配的权限
+// @auth                     (2020/04/05  20:22 )
+// @param     v               int
+// @param     p               string
+// @return                    bool
+func (c *CasbinModel) ClearCasbin(v int, p string) bool {
 	e := Casbin()
 	e := Casbin()
 	return e.RemoveFilteredPolicy(v, p)
 	return e.RemoveFilteredPolicy(v, p)
 
 
 }
 }
 
 
-// 自定义规则函数
+// @title    ParamsMatch
+// @description   customized rule, 自定义规则函数
+// @auth                     (2020/04/05  20:22 )
+// @param     fullNameKey1    string
+// @param     key2            string
+// @return                    bool
 func ParamsMatch(fullNameKey1 string, key2 string) bool {
 func ParamsMatch(fullNameKey1 string, key2 string) bool {
 	key1 := strings.Split(fullNameKey1, "?")[0]
 	key1 := strings.Split(fullNameKey1, "?")[0]
 	//剥离路径后再使用casbin的keyMatch2
 	//剥离路径后再使用casbin的keyMatch2
 	return util.KeyMatch2(key1, key2)
 	return util.KeyMatch2(key1, key2)
 }
 }
 
 
-// 自定义规则函数
+// @title    ParamsMatchFunc
+// @description   customized function, 自定义规则函数
+// @auth                     (2020/04/05  20:22 )
+// @param     args            ...interface{}
+// @return                    interface{}
+// @return                    error
 func ParamsMatchFunc(args ...interface{}) (interface{}, error) {
 func ParamsMatchFunc(args ...interface{}) (interface{}, error) {
 	name1 := args[0].(string)
 	name1 := args[0].(string)
 	name2 := args[1].(string)
 	name2 := args[1].(string)
@@ -94,11 +127,13 @@ func ParamsMatchFunc(args ...interface{}) (interface{}, error) {
 	return (bool)(ParamsMatch(name1, name2)), nil
 	return (bool)(ParamsMatch(name1, name2)), nil
 }
 }
 
 
-//持久化到数据库  引入自定义规则
+// @title    Casbin
+// @description   store to DB, 持久化到数据库  引入自定义规则
+// @auth                     (2020/04/05  20:22 )
 func Casbin() *casbin.Enforcer {
 func Casbin() *casbin.Enforcer {
 	a := gormadapter.NewAdapterByDB(global.GVA_DB)
 	a := gormadapter.NewAdapterByDB(global.GVA_DB)
-	e := casbin.NewEnforcer(global.GVA_CONFIG.CasbinConfig.ModelPath, a)
+	e := casbin.NewEnforcer(global.GVA_CONFIG.Casbin.ModelPath, a)
 	e.AddFunction("ParamsMatch", ParamsMatchFunc)
 	e.AddFunction("ParamsMatch", ParamsMatchFunc)
-	e.LoadPolicy()
+	_ = e.LoadPolicy()
 	return e
 	return e
 }
 }

+ 6 - 0
server/model/sys_common.go

@@ -0,0 +1,6 @@
+package model
+
+type PageInfo struct {
+	Page     int `json:"page"`
+	PageSize int `json:"pageSize"`
+}

+ 19 - 3
server/model/sys_jwt_blacklist.go

@@ -10,24 +10,40 @@ type JwtBlacklist struct {
 	Jwt string `gorm:"type:text"`
 	Jwt string `gorm:"type:text"`
 }
 }
 
 
+// @title    JsonInBlacklist
+// @description   create jwt blacklist
+// @auth                     (2020/04/05  20:22 )
+// @return    err             error
 func (j *JwtBlacklist) JsonInBlacklist() (err error) {
 func (j *JwtBlacklist) JsonInBlacklist() (err error) {
 	err = global.GVA_DB.Create(j).Error
 	err = global.GVA_DB.Create(j).Error
 	return
 	return
 }
 }
 
 
-//判断JWT是否在黑名单内部
+// @title    IsBlacklist
+// @description   check if the Jwt is in the blacklist or not, 判断JWT是否在黑名单内部
+// @auth                     (2020/04/05  20:22 )
+// @param     newPassword     string
+// @return    err             error
 func (j *JwtBlacklist) IsBlacklist(Jwt string) bool {
 func (j *JwtBlacklist) IsBlacklist(Jwt string) bool {
 	isNotFound := global.GVA_DB.Where("jwt = ?", Jwt).First(j).RecordNotFound()
 	isNotFound := global.GVA_DB.Where("jwt = ?", Jwt).First(j).RecordNotFound()
 	return !isNotFound
 	return !isNotFound
 }
 }
 
 
-//判断当前用户是否在线
+// @title    GetRedisJWT
+// @description   Get user info in redis
+// @auth                     (2020/04/05  20:22 )
+// @param     newPassword     string
+// @return    err             error
 func (j *JwtBlacklist) GetRedisJWT(userName string) (err error, RedisJWT string) {
 func (j *JwtBlacklist) GetRedisJWT(userName string) (err error, RedisJWT string) {
 	RedisJWT, err = global.GVA_REDIS.Get(userName).Result()
 	RedisJWT, err = global.GVA_REDIS.Get(userName).Result()
 	return err, RedisJWT
 	return err, RedisJWT
 }
 }
 
 
-//设置当前用户在线
+// @title    SetRedisJWT
+// @description   set jwt into the Redis
+// @auth                     (2020/04/05  20:22 )
+// @param     userName        string
+// @return    err             error
 func (j *JwtBlacklist) SetRedisJWT(userName string) (err error) {
 func (j *JwtBlacklist) SetRedisJWT(userName string) (err error) {
 	err = global.GVA_REDIS.Set(userName, j.Jwt, 1000*1000*1000*60*60*24*7).Err()
 	err = global.GVA_REDIS.Set(userName, j.Jwt, 1000*1000*1000*60*60*24*7).Err()
 	return err
 	return err

+ 12 - 5
server/model/sys_system.go

@@ -1,22 +1,29 @@
 package model
 package model
 
 
 import (
 import (
+	"gin-vue-admin/config"
 	"gin-vue-admin/global"
 	"gin-vue-admin/global"
-	"gin-vue-admin/init"
 	"gin-vue-admin/utils"
 	"gin-vue-admin/utils"
 )
 )
 
 
 //配置文件结构体
 //配置文件结构体
 type System struct {
 type System struct {
-	Config init.Config
+	Config config.Server
 }
 }
 
 
-//读取配置文件
-func (s *System) GetSystemConfig() (err error, conf init.Config) {
+// @title    GetSystemConfig
+// @description   读取配置文件
+// @auth                     (2020/04/05  20:22 )
+// @return    err             error
+// @return    conf            Server
+func (s *System) GetSystemConfig() (err error, conf config.Server) {
 	return nil, global.GVA_CONFIG
 	return nil, global.GVA_CONFIG
 }
 }
 
 
-//设置配置文件
+// @title    SetSystemConfig
+// @description   set system config, 设置配置文件
+// @auth                    (2020/04/05  20:22 )
+// @return    err            error
 func (s *System) SetSystemConfig() (err error) {
 func (s *System) SetSystemConfig() (err error) {
 	confs := utils.StructToMap(s.Config)
 	confs := utils.StructToMap(s.Config)
 	for k, v := range confs {
 	for k, v := range confs {

+ 52 - 11
server/model/sys_user.go

@@ -19,11 +19,26 @@ type SysUser struct {
 	AuthorityId string       `json:"authorityId" gorm:"default:888"`
 	AuthorityId string       `json:"authorityId" gorm:"default:888"`
 }
 }
 
 
-//type Propertie struct {
-//	gorm.Model
-//}
+type RegisterAndLoginStruct struct {
+	Username  string `json:"username"`
+	Password  string `json:"password"`
+	Captcha   string `json:"captcha"`
+	CaptchaId string `json:"captchaId"`
+}
+
+type RegisterStruct struct {
+	Username    string `json:"userName"`
+	Password    string `json:"passWord"`
+	NickName    string `json:"nickName" gorm:"default:'QMPlusUser'"`
+	HeaderImg   string `json:"headerImg" gorm:"default:'http://www.henrongyi.top/avatar/lufu.jpg'"`
+	AuthorityId string `json:"authorityId" gorm:"default:888"`
+}
 
 
-//注册接口model方法
+// @title    Register
+// @description   register, 用户注册
+// @auth                     (2020/04/05  20:22 )
+// @return    err             error
+// @return    userInter       *SysUser
 func (u *SysUser) Register() (err error, userInter *SysUser) {
 func (u *SysUser) Register() (err error, userInter *SysUser) {
 	var user SysUser
 	var user SysUser
 	//判断用户名是否注册
 	//判断用户名是否注册
@@ -40,7 +55,12 @@ func (u *SysUser) Register() (err error, userInter *SysUser) {
 	return err, u
 	return err, u
 }
 }
 
 
-//修改用户密码
+// @title    ChangePassword
+// @description   change the password of a certain user, 修改用户密码
+// @auth                     (2020/04/05  20:22 )
+// @param     newPassword     string
+// @return    err             error
+// @return    userInter       *SysUser
 func (u *SysUser) ChangePassword(newPassword string) (err error, userInter *SysUser) {
 func (u *SysUser) ChangePassword(newPassword string) (err error, userInter *SysUser) {
 	var user SysUser
 	var user SysUser
 	//后期修改jwt+password模式
 	//后期修改jwt+password模式
@@ -49,13 +69,22 @@ func (u *SysUser) ChangePassword(newPassword string) (err error, userInter *SysU
 	return err, u
 	return err, u
 }
 }
 
 
-//用户更新接口
-func (u *SysUser) SetUserAuthority(uuid uuid.UUID, AuthorityId string) (err error) {
-	err = global.GVA_DB.Where("uuid = ?", uuid).First(&SysUser{}).Update("authority_id", AuthorityId).Error
+// @title    SetUserAuthority
+// @description   set the authority of a certain user, 设置一个用户的权限
+// @auth                     (2020/04/05  20:22 )
+// @param     uuid            UUID
+// @param     authorityId     string
+// @return    err             error
+func (u *SysUser) SetUserAuthority(uuid uuid.UUID, authorityId string) (err error) {
+	err = global.GVA_DB.Where("uuid = ?", uuid).First(&SysUser{}).Update("authority_id", authorityId).Error
 	return err
 	return err
 }
 }
 
 
-//用户登录
+// @title    Login
+// @description   login, 用户登录
+// @auth                     (2020/04/05  20:22 )
+// @return    err             error
+// @return    userInter       *SysUser
 func (u *SysUser) Login() (err error, userInter *SysUser) {
 func (u *SysUser) Login() (err error, userInter *SysUser) {
 	var user SysUser
 	var user SysUser
 	u.Password = utils.MD5V([]byte(u.Password))
 	u.Password = utils.MD5V([]byte(u.Password))
@@ -67,14 +96,26 @@ func (u *SysUser) Login() (err error, userInter *SysUser) {
 	return err, &user
 	return err, &user
 }
 }
 
 
-// 用户头像上传更新地址
+// @title    UploadHeaderImg
+// @description   upload avatar, 用户头像上传更新地址
+// @auth                     (2020/04/05  20:22 )
+// @param     uuid            UUID
+// @param     filePath        string
+// @return    err             error
+// @return    userInter       *SysUser
 func (u *SysUser) UploadHeaderImg(uuid uuid.UUID, filePath string) (err error, userInter *SysUser) {
 func (u *SysUser) UploadHeaderImg(uuid uuid.UUID, filePath string) (err error, userInter *SysUser) {
 	var user SysUser
 	var user SysUser
 	err = global.GVA_DB.Where("uuid = ?", uuid).First(&user).Update("header_img", filePath).First(&user).Error
 	err = global.GVA_DB.Where("uuid = ?", uuid).First(&user).Update("header_img", filePath).First(&user).Error
 	return err, &user
 	return err, &user
 }
 }
 
 
-// 分页获取数据
+// @title    GetInfoList
+// @description   get user list by pagination, 分页获取数据
+// @auth                      (2020/04/05  20:22 )
+// @param     PageInfo         int
+// @return    err              error
+// @return    list             interface{}
+// @return    total            int
 func (u *SysUser) GetInfoList(info PageInfo) (err error, list interface{}, total int) {
 func (u *SysUser) GetInfoList(info PageInfo) (err error, list interface{}, total int) {
 	limit := info.PageSize
 	limit := info.PageSize
 	offset := info.PageSize * (info.Page - 1)
 	offset := info.PageSize * (info.Page - 1)

+ 4 - 1
server/model/sys_workflow.go

@@ -25,7 +25,10 @@ type SysWorkflowStepInfo struct {
 	IsEnd           bool    `json:"isEnd"`           // 是否是完结流节点
 	IsEnd           bool    `json:"isEnd"`           // 是否是完结流节点
 }
 }
 
 
-//创建工作流
+// @title    Create
+// @description   create a workflow, 创建工作流
+// @auth                     (2020/04/05  20:22 )
+// @return                    error
 func (wk *SysWorkflow) Create() error {
 func (wk *SysWorkflow) Create() error {
 	err := global.GVA_DB.Create(&wk).Error
 	err := global.GVA_DB.Create(&wk).Error
 	return err
 	return err

+ 8 - 7
server/resource/template/te/model.go.tpl

@@ -2,8 +2,9 @@
 package {{.PackageName}}
 package {{.PackageName}}
 
 
 import (
 import (
-	"gin-vue-admin/init/qmsql"
-	"github.com/jinzhu/gorm"
+	"gin-vue-admin/global"
+    "github.com/jinzhu/gorm"
+    "github.com/pkg/errors"
 )
 )
 
 
 type {{.StructName}} struct {
 type {{.StructName}} struct {
@@ -13,25 +14,25 @@ type {{.StructName}} struct {
 
 
 // 创建{{.StructName}}
 // 创建{{.StructName}}
 func ({{.Abbreviation}} *{{.StructName}})Create{{.StructName}}()(err error){
 func ({{.Abbreviation}} *{{.StructName}})Create{{.StructName}}()(err error){
-        err = qmsql.DEFAULTDB.Create({{.Abbreviation}}).Error
+        err = global.GVA_DB.Create({{.Abbreviation}}).Error
         return err
         return err
 }
 }
 
 
 // 删除{{.StructName}}
 // 删除{{.StructName}}
 func ({{.Abbreviation}} *{{.StructName}})Delete{{.StructName}}()(err error){
 func ({{.Abbreviation}} *{{.StructName}})Delete{{.StructName}}()(err error){
-        err = qmsql.DEFAULTDB.Delete({{.Abbreviation}}).Error
+        err = global.GVA_DB.Delete({{.Abbreviation}}).Error
         return err
         return err
 }
 }
 
 
 // 更新{{.StructName}}
 // 更新{{.StructName}}
 func ({{.Abbreviation}} *{{.StructName}})Update{{.StructName}}()(err error, re{{.Abbreviation}} {{.StructName}}){
 func ({{.Abbreviation}} *{{.StructName}})Update{{.StructName}}()(err error, re{{.Abbreviation}} {{.StructName}}){
-        err = qmsql.DEFAULTDB.Save({{.Abbreviation}}).Error
+        err = global.GVA_DB.Save({{.Abbreviation}}).Error
         return err, *{{.Abbreviation}}
         return err, *{{.Abbreviation}}
 }
 }
 
 
 // 根据ID查看单条{{.StructName}}
 // 根据ID查看单条{{.StructName}}
 func ({{.Abbreviation}} *{{.StructName}})FindById()(err error,re{{.Abbreviation}} {{.StructName}}){
 func ({{.Abbreviation}} *{{.StructName}})FindById()(err error,re{{.Abbreviation}} {{.StructName}}){
-    err = qmsql.DEFAULTDB.Where("id = ?",{{.Abbreviation}}.ID).First(&re{{.Abbreviation}}).Error
+    err = global.GVA_DB.Where("id = ?",{{.Abbreviation}}.ID).First(&re{{.Abbreviation}}).Error
     return err,re{{.Abbreviation}}
     return err,re{{.Abbreviation}}
 }
 }
 
 
@@ -39,7 +40,7 @@ func ({{.Abbreviation}} *{{.StructName}})FindById()(err error,re{{.Abbreviation}
 func ({{.Abbreviation}} *{{.StructName}})GetInfoList(info PageInfo)(err error, list interface{}, total int){
 func ({{.Abbreviation}} *{{.StructName}})GetInfoList(info PageInfo)(err error, list interface{}, total int){
     	limit := info.PageSize
     	limit := info.PageSize
         offset := info.PageSize * (info.Page - 1)
         offset := info.PageSize * (info.Page - 1)
-        db:=qmsql.DEFAULTDB
+        db:=global.GVA_DB
     	if err != nil {
     	if err != nil {
     		return
     		return
     	} else {
     	} else {

+ 1 - 1
server/router/sys_casbin.go

@@ -9,7 +9,7 @@ import (
 func InitCasbinRouter(Router *gin.RouterGroup) {
 func InitCasbinRouter(Router *gin.RouterGroup) {
 	CasbinRouter := Router.Group("casbin").Use(middleware.JWTAuth()).Use(middleware.CasbinHandler())
 	CasbinRouter := Router.Group("casbin").Use(middleware.JWTAuth()).Use(middleware.CasbinHandler())
 	{
 	{
-		CasbinRouter.POST("casbinPUpdate", v1.CasbinPUpdate)
+		CasbinRouter.POST("UpdateCasbin", v1.UpdateCasbin)
 		CasbinRouter.POST("getPolicyPathByAuthorityId", v1.GetPolicyPathByAuthorityId)
 		CasbinRouter.POST("getPolicyPathByAuthorityId", v1.GetPolicyPathByAuthorityId)
 		CasbinRouter.GET("casbinTest/:pathParam", v1.CasbinTest)
 		CasbinRouter.GET("casbinTest/:pathParam", v1.CasbinTest)
 	}
 	}

+ 3 - 3
web/src/api/casbin.js

@@ -7,11 +7,11 @@ import service from '@/utils/request'
 // @Produce application/json
 // @Produce application/json
 // @Param data body api.CreateAuthorityPatams true "更改角色api权限"
 // @Param data body api.CreateAuthorityPatams true "更改角色api权限"
 // @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}"
 // @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}"
-// @Router /casbin/casbinPUpdate [post]
+// @Router /casbin/UpdateCasbin [post]
 
 
-export const casbinPUpdate = (data) => {
+export const UpdateCasbin = (data) => {
     return service({
     return service({
-        url: "/casbin/casbinPUpdate",
+        url: "/casbin/UpdateCasbin",
         method: 'post',
         method: 'post',
         data
         data
     })
     })

+ 3 - 2
web/src/store/module/user.js

@@ -31,6 +31,7 @@ export const user = {
             state.token = ""
             state.token = ""
             state.expiresAt = ""
             state.expiresAt = ""
             router.push({ name: 'login', replace: true })
             router.push({ name: 'login', replace: true })
+            sessionStorage.clear()
             window.location.reload()
             window.location.reload()
         },
         },
         ResetUserInfo(state, userInfo = {}) {
         ResetUserInfo(state, userInfo = {}) {
@@ -45,7 +46,7 @@ export const user = {
             commit('setUserInfo', res.data.user)
             commit('setUserInfo', res.data.user)
             commit('setToken', res.data.token)
             commit('setToken', res.data.token)
             commit('setExpiresAt', res.data.expiresAt)
             commit('setExpiresAt', res.data.expiresAt)
-            if (res.success) {
+            if (res.code == 0) {
                 const redirect = router.history.current.query.redirect
                 const redirect = router.history.current.query.redirect
                 if (redirect) {
                 if (redirect) {
                     router.push({ path: redirect })
                     router.push({ path: redirect })
@@ -56,7 +57,7 @@ export const user = {
         },
         },
         async LoginOut({ commit }) {
         async LoginOut({ commit }) {
             const res = await jsonInBlacklist()
             const res = await jsonInBlacklist()
-            if (res.success) {
+            if (res.code == 0) {
                 commit("LoginOut")
                 commit("LoginOut")
             }
             }
         }
         }

+ 7 - 7
web/src/utils/request.js

@@ -21,13 +21,13 @@ const showLoading = () => {
 }
 }
 
 
 const closeLoading = () => {
 const closeLoading = () => {
-        acitveAxios--
-        if (acitveAxios <= 0) {
-            clearTimeout(timer)
-            loadingInstance && loadingInstance.close()
-        }
+    acitveAxios--
+    if (acitveAxios <= 0) {
+        clearTimeout(timer)
+        loadingInstance && loadingInstance.close()
     }
     }
-    //http request 拦截器
+}
+//http request 拦截器
 service.interceptors.request.use(
 service.interceptors.request.use(
     config => {
     config => {
         showLoading()
         showLoading()
@@ -55,7 +55,7 @@ service.interceptors.request.use(
 service.interceptors.response.use(
 service.interceptors.response.use(
     response => {
     response => {
         closeLoading()
         closeLoading()
-        if (response.data.success || response.headers.success === "true") {
+        if (response.data.code == 0 || response.headers.success === "true") {
             return response.data
             return response.data
         } else {
         } else {
             Message({
             Message({

+ 1 - 1
web/src/view/example/breakpoint/breakpoint.vue

@@ -119,7 +119,7 @@ export default {
           fileMd5: this.fileMd5
           fileMd5: this.fileMd5
         }
         }
         const res = await breakpointContinueFinish(params)
         const res = await breakpointContinueFinish(params)
-        if (res.success) {
+        if (res.code == 0) {
           // 合成文件过后 删除缓存切片
           // 合成文件过后 删除缓存切片
           const params = {
           const params = {
             fileName: this.file.name,
             fileName: this.file.name,

+ 3 - 3
web/src/view/example/customer/customer.vue

@@ -116,7 +116,7 @@ export default {
     async updateCustomer(row){
     async updateCustomer(row){
       const res = await getExaCustomer(row)
       const res = await getExaCustomer(row)
       this.type = "update"
       this.type = "update"
-      if(res.success){
+      if(res.code == 0){
         this.form = res.data.customer        
         this.form = res.data.customer        
         this.dialogFormVisible = true
         this.dialogFormVisible = true
       }
       }
@@ -127,7 +127,7 @@ export default {
     async deleteCustomer(row){
     async deleteCustomer(row){
       this.visible = false
       this.visible = false
       const res = await deleteExaCustomer(row)
       const res = await deleteExaCustomer(row)
-      if (res.success){
+      if (res.code == 0){
          this.getTableData()
          this.getTableData()
       }
       }
     },
     },
@@ -146,7 +146,7 @@ export default {
 
 
       }
       }
      
      
-      if(res.success){
+      if(res.code == 0){
         this.dialogFormVisible = false
         this.dialogFormVisible = false
         this.getTableData()
         this.getTableData()
       }
       }

+ 2 - 2
web/src/view/example/upload/upload.vue

@@ -108,7 +108,7 @@ export default {
       })
       })
         .then(async () => {
         .then(async () => {
           const res = await deleteFile(row)
           const res = await deleteFile(row)
-          if (res.success) {
+          if (res.code == 0) {
             this.$message({
             this.$message({
               type: 'success',
               type: 'success',
               message: '删除成功!'
               message: '删除成功!'
@@ -143,7 +143,7 @@ export default {
         type: 'success',
         type: 'success',
         message: '上传成功'
         message: '上传成功'
       })
       })
-      if (res.success) {
+      if (res.code == 0) {
         this.getTableData()
         this.getTableData()
       }
       }
         this.fullscreenLoading = false
         this.fullscreenLoading = false

+ 21 - 8
web/src/view/layout/aside/historyComponent/history.vue

@@ -16,18 +16,32 @@ export default {
     name:"HistoryComponent",
     name:"HistoryComponent",
     data(){
     data(){
         return{
         return{
-            historys:[
+            historys:[],
+            activeValue:"dashbord"
+        }
+    },
+    created(){
+        const initHistorys = [
                 {
                 {
                 name:"dashbord",
                 name:"dashbord",
                 meta:{
                 meta:{
                     title:"仪表盘"
                     title:"仪表盘"
                 }
                 }
                 }
                 }
-            ],
-            activeValue:"dashbord"
-        }
+            ]
+        this.historys = JSON.parse(sessionStorage.getItem("historys")) || initHistorys
+        this.setTab(this.$route)
     },
     },
     methods:{
     methods:{
+        setTab(route){
+        if(!this.historys.some(item=>item.name==route.name)){
+           const obj = {}
+           obj.name = route.name
+           obj.meta = route.meta
+        this.historys.push(obj)
+       }
+           this.activeValue = this.$route.name
+        },
         changeTab(tab){
         changeTab(tab){
             this.$router.push({name:tab.name})
             this.$router.push({name:tab.name})
         },
         },
@@ -50,11 +64,10 @@ export default {
     watch:{
     watch:{
      $route( to ){
      $route( to ){
        this.historys = this.historys.filter(item=>!item.meta.hidden)
        this.historys = this.historys.filter(item=>!item.meta.hidden)
-       if(!this.historys.some(item=>item.name==to.name)){
-        this.historys.push(to)
-       }
-       this.activeValue = to.name
+       this.setTab(to)
+       sessionStorage.setItem("historys",JSON.stringify(this.historys))
      }
      }
+     
     }
     }
 }
 }
 </script>
 </script>

+ 1 - 1
web/src/view/layout/index.vue

@@ -22,7 +22,7 @@
             <el-dropdown>
             <el-dropdown>
               <span class="el-dropdown-link">
               <span class="el-dropdown-link">
                 <img :src="userInfo.headerImg" height="30" width="30" />
                 <img :src="userInfo.headerImg" height="30" width="30" />
-                {{userInfo.nickName}}
+                {{userInfo.title}}
                 <i class="el-icon-arrow-down"></i>
                 <i class="el-icon-arrow-down"></i>
               </span>
               </span>
               <el-dropdown-menu class="dropdown-group" slot="dropdown">
               <el-dropdown-menu class="dropdown-group" slot="dropdown">

+ 1 - 1
web/src/view/login/register.vue

@@ -83,7 +83,7 @@ export default {
       this.$refs.registerForm.validate(async v => {
       this.$refs.registerForm.validate(async v => {
         if (v) {
         if (v) {
           const res = await register(this.registerForm)
           const res = await register(this.registerForm)
-          if (res.success) {
+          if (res.code == 0) {
             this.$message({
             this.$message({
               type: 'success',
               type: 'success',
               message: '注册成功',
               message: '注册成功',

+ 4 - 9
web/src/view/superAdmin/api/api.vue

@@ -167,12 +167,7 @@ export default {
       this.getTableData()
       this.getTableData()
     },
     },
     initForm() {
     initForm() {
-      this.form = {
-        path: '',
-        apiGroup: '',
-        description: '',
-        method: ''
-      }
+      this.$refs.apiForm.resetFields()
     },
     },
     closeDialog() {
     closeDialog() {
       this.initForm()
       this.initForm()
@@ -195,7 +190,7 @@ export default {
       })
       })
         .then(async () => {
         .then(async () => {
           const res = await deleteApi(row)
           const res = await deleteApi(row)
-          if (res.success) {
+          if (res.code == 0) {
             this.$message({
             this.$message({
               type: 'success',
               type: 'success',
               message: '删除成功!'
               message: '删除成功!'
@@ -217,7 +212,7 @@ export default {
             case 'addApi':
             case 'addApi':
               {
               {
                 const res = await createApi(this.form)
                 const res = await createApi(this.form)
-                if (res.success) {
+                if (res.code == 0) {
                   this.$message({
                   this.$message({
                     type: 'success',
                     type: 'success',
                     message: '添加成功',
                     message: '添加成功',
@@ -232,7 +227,7 @@ export default {
             case 'edit':
             case 'edit':
               {
               {
                 const res = await updateApi(this.form)
                 const res = await updateApi(this.form)
-                if (res.success) {
+                if (res.code == 0) {
                   this.$message({
                   this.$message({
                     type: 'success',
                     type: 'success',
                     message: '添加成功',
                     message: '添加成功',

+ 3 - 5
web/src/view/superAdmin/authority/authority.vue

@@ -119,7 +119,7 @@ export default {
       })
       })
         .then(async () => {
         .then(async () => {
           const res = await deleteAuthority({ authorityId: row.authorityId })
           const res = await deleteAuthority({ authorityId: row.authorityId })
-          if (res.success) {
+          if (res.code == 0) {
             this.$message({
             this.$message({
               type: 'success',
               type: 'success',
               message: '删除成功!'
               message: '删除成功!'
@@ -136,9 +136,7 @@ export default {
     },
     },
     // 初始化表单
     // 初始化表单
     initForm() {
     initForm() {
-      for (const key in this.form) {
-        this.form[key] = ''
-      }
+      this.$refs.authorityForm.resetFields()
     },
     },
     // 关闭窗口
     // 关闭窗口
     closeDialog() {
     closeDialog() {
@@ -159,7 +157,7 @@ export default {
       this.$refs.authorityForm.validate(async valid => {
       this.$refs.authorityForm.validate(async valid => {
         if (valid) {
         if (valid) {
           const res = await createAuthority(this.form)
           const res = await createAuthority(this.form)
-          if (res.success) {
+          if (res.code == 0) {
             this.$message({
             this.$message({
               type: 'success',
               type: 'success',
               message: '添加成功!'
               message: '添加成功!'

+ 6 - 6
web/src/view/superAdmin/authority/components/apis.vue

@@ -17,7 +17,7 @@
 </template>
 </template>
 <script>
 <script>
 import { getAllApis } from '@/api/api'
 import { getAllApis } from '@/api/api'
-import { casbinPUpdate, getPolicyPathByAuthorityId } from '@/api/casbin'
+import { UpdateCasbin, getPolicyPathByAuthorityId } from '@/api/casbin'
 export default {
 export default {
   name: 'Apis',
   name: 'Apis',
   props: {
   props: {
@@ -44,10 +44,10 @@ export default {
       const apiObj = new Object()
       const apiObj = new Object()
       apis &&
       apis &&
         apis.map(item => {
         apis.map(item => {
-          if (apiObj.hasOwnProperty(item.group)) {
-            apiObj[item.group].push(item)
+          if (apiObj.hasOwnProperty(item.apiGroup)) {
+            apiObj[item.apiGroup].push(item)
           } else {
           } else {
-            Object.assign(apiObj, { [item.group]: [item] })
+            Object.assign(apiObj, { [item.apiGroup]: [item] })
           }
           }
         })
         })
       const apiTree = []
       const apiTree = []
@@ -72,11 +72,11 @@ export default {
         }
         }
         casbinInfos.push(casbinInfo)
         casbinInfos.push(casbinInfo)
       })
       })
-      const res = await casbinPUpdate({
+      const res = await UpdateCasbin({
         authorityId: this.activeUserId,
         authorityId: this.activeUserId,
         casbinInfos
         casbinInfos
       })
       })
-      if (res.success) {
+      if (res.code == 0) {
         this.$message({ type: 'success', message: res.msg })
         this.$message({ type: 'success', message: res.msg })
       }
       }
     }
     }

+ 1 - 1
web/src/view/superAdmin/authority/components/datas.vue

@@ -60,7 +60,7 @@ export default {
     // 提交
     // 提交
       async authDataEnter(){
       async authDataEnter(){
           const res = await setDataAuthority(this.row)
           const res = await setDataAuthority(this.row)
-          if(res.success){
+          if(res.code == 0){
               this.$message({ type: 'success', message: res.msg })
               this.$message({ type: 'success', message: res.msg })
           }
           }
       },
       },

+ 6 - 4
web/src/view/superAdmin/authority/components/menus.vue

@@ -34,7 +34,9 @@ export default {
       menuTreeIds: [],
       menuTreeIds: [],
       menuDefaultProps: {
       menuDefaultProps: {
         children: 'children',
         children: 'children',
-        label: 'nickName'
+        label: function(data){
+          return data.meta.title
+        }
       }
       }
     }
     }
   },
   },
@@ -46,7 +48,7 @@ export default {
         menus: checkArr,
         menus: checkArr,
         authorityId: this.row.authorityId
         authorityId: this.row.authorityId
       })
       })
-      if (res.success) {
+      if (res.code == 0) {
         this.$message({
         this.$message({
           type: 'success',
           type: 'success',
           message: '添加成功!'
           message: '添加成功!'
@@ -64,8 +66,8 @@ export default {
     const arr = []
     const arr = []
     menus.map(item => {
     menus.map(item => {
       // 防止直接选中父级造成全选
       // 防止直接选中父级造成全选
-      if (!menus.some(same => same.parentId === item.menuId)) {
-        arr.push(Number(item.menuId))
+      if (!menus.some(same => same.parentId === item.ID)) {
+        arr.push(Number(item.ID))
       }
       }
     })
     })
     this.menuTreeIds = arr
     this.menuTreeIds = arr

+ 3 - 13
web/src/view/superAdmin/menu/menu.vue

@@ -145,7 +145,7 @@ export default {
       })
       })
         .then(async () => {
         .then(async () => {
           const res = await deleteBaseMenu({ ID })
           const res = await deleteBaseMenu({ ID })
-          if (res.success) {
+          if (res.code == 0) {
             this.$message({
             this.$message({
               type: 'success',
               type: 'success',
               message: '删除成功!'
               message: '删除成功!'
@@ -162,17 +162,7 @@ export default {
     },
     },
     // 初始化弹窗内表格方法
     // 初始化弹窗内表格方法
     initForm() {
     initForm() {
-      this.form = {
-        path: '',
-        name: '',
-        hidden: '',
-        parentId: '',
-        component: '',
-        meta: {
-          title: '',
-          icon: ''
-        }
-      }
+      this.$refs.menuForm.resetFields()
     },
     },
     // 关闭弹窗
     // 关闭弹窗
     closeDialog() {
     closeDialog() {
@@ -190,7 +180,7 @@ export default {
           } else {
           } else {
             res = await addBaseMenu(this.form)
             res = await addBaseMenu(this.form)
           }
           }
-          if (res.success) {
+          if (res.code == 0) {
             this.$message({
             this.$message({
               type: 'success',
               type: 'success',
               message: '添加成功!'
               message: '添加成功!'

+ 3 - 9
web/src/view/superAdmin/user/user.vue

@@ -132,7 +132,7 @@ export default {
       this.$refs.userForm.validate(async valid => {
       this.$refs.userForm.validate(async valid => {
         if (valid) {
         if (valid) {
           const res = await register(this.userInfo)
           const res = await register(this.userInfo)
-          if (res.success) {
+          if (res.code == 0) {
             this.$message({ type: 'success', message: '创建成功' })
             this.$message({ type: 'success', message: '创建成功' })
           }
           }
           await this.getTableData()
           await this.getTableData()
@@ -141,13 +141,7 @@ export default {
       })
       })
     },
     },
     closeAddUserDialog() {
     closeAddUserDialog() {
-      this.userInfo = {
-        username: '',
-        password: '',
-        nickName: '',
-        headerImg: '',
-        authorityId: ''
-      }
+      this.$refs.userForm.resetFields()
       this.addUserDialog = false
       this.addUserDialog = false
     },
     },
     handleAvatarSuccess(res) {
     handleAvatarSuccess(res) {
@@ -161,7 +155,7 @@ export default {
         uuid: row.uuid,
         uuid: row.uuid,
         authorityId: row.authority.authorityId
         authorityId: row.authority.authorityId
       })
       })
-      if (res.success) {
+      if (res.code == 0) {
         this.$message({ type: 'success', message: '角色设置成功' })
         this.$message({ type: 'success', message: '角色设置成功' })
       }
       }
     }
     }

+ 2 - 2
web/src/view/systemTools/system/system.vue

@@ -115,14 +115,14 @@ export default {
   methods: {
   methods: {
     async initForm() {
     async initForm() {
       const res = await getSystemConfig()
       const res = await getSystemConfig()
-      if (res.success) {
+      if (res.code == 0) {
         this.config = res.data.config
         this.config = res.data.config
       }
       }
     },
     },
     reload() {},
     reload() {},
     async update() {
     async update() {
       const res = await setSystemConfig({ config: this.config })
       const res = await setSystemConfig({ config: this.config })
-      if (res.success) {
+      if (res.code == 0) {
         this.$message({
         this.$message({
           type: 'success',
           type: 'success',
           message: '配置文件设置成功'
           message: '配置文件设置成功'

+ 1 - 1
web/src/view/workflow/workflowCreate/workflowCreate.vue

@@ -101,7 +101,7 @@ export default {
     },
     },
     async submit() {
     async submit() {
       const res = await createWorkFlow(this.form)
       const res = await createWorkFlow(this.form)
-      if(res.success){
+      if(res.code == 0){
           this.$message({
           this.$message({
               message:"创建成功",
               message:"创建成功",
               type:"success"
               type:"success"

+ 4 - 4
web/vue.config.js

@@ -1,7 +1,7 @@
 'use strict'
 'use strict'
 
 
 const path = require('path')
 const path = require('path')
-  
+
 function resolve(dir) {
 function resolve(dir) {
     return path.join(__dirname, dir)
     return path.join(__dirname, dir)
 }
 }
@@ -51,10 +51,10 @@ module.exports = {
             })
             })
             .end()
             .end()
         config
         config
-        // https://webpack.js.org/configuration/devtool/#development
+            // https://webpack.js.org/configuration/devtool/#development
             .when(process.env.NODE_ENV === 'development',
             .when(process.env.NODE_ENV === 'development',
-            config => config.devtool('cheap-source-map')
-        )
+                config => config.devtool('cheap-source-map')
+            )
 
 
         config
         config
             .when(process.env.NODE_ENV !== 'development',
             .when(process.env.NODE_ENV !== 'development',