Ver Fonte

方法添加注释,中文版注释

rainyan há 5 anos atrás
pai
commit
a0b6909506

+ 21 - 22
README.md

@@ -38,31 +38,30 @@
 ## 项目目录
 
 ```
-    ├─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	(静态文件)
             ├─components(组件)
             ├─router	(前端路由)
-            ├─store	(vuex 状态管理仓)
-            ├─style	(通用样式文件)
-            ├─utils	(前端工具库)
-            └─view	(前端页面)
+            ├─store	    (vuex 状态管理仓)
+            ├─style	    (通用样式文件)
+            ├─utils	    (前端工具库)
+            └─view	    (前端页面)
 
 ```
 

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

@@ -7,15 +7,6 @@ import (
 	"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
 // @Summary 创建基础api
 // @Security ApiKeyAuth

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

@@ -14,11 +14,11 @@ import (
 // @Produce application/json
 // @Param data body sysModel.CasbinInReceive true "更改角色api权限"
 // @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
 	_ = c.ShouldBindJSON(&cmr)
-	err := new(model.CasbinModel).CasbinPUpdate(cmr.AuthorityId, cmr.CasbinInfos)
+	err := new(model.CasbinModel).UpdateCasbin(cmr.AuthorityId, cmr.CasbinInfos)
 	if err != nil {
 		response.Result(response.ERROR, gin.H{}, fmt.Sprintf("添加规则失败,%v", err), c)
 	} else {

+ 2 - 2
server/api/v1/sys_menu.go

@@ -12,7 +12,7 @@ import (
 // @Summary 获取用户动态路由
 // @Security ApiKeyAuth
 // @Produce  application/json
-// @Param data body api.RegisterAndLoginStuct true "可以什么都不填"
+// @Param data body api.RegisterAndLoginStruct true "可以什么都不填"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}"
 // @Router /menu/getMenu [post]
 func GetMenu(c *gin.Context) {
@@ -73,7 +73,7 @@ func AddBaseMenu(c *gin.Context) {
 // @Summary 获取用户动态路由
 // @Security ApiKeyAuth
 // @Produce  application/json
-// @Param data body api.RegisterAndLoginStuct true "可以什么都不填"
+// @Param data body api.RegisterAndLoginStruct true "可以什么都不填"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}"
 // @Router /menu/getBaseMenuTree [post]
 func GetBaseMenuTree(c *gin.Context) {

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

@@ -16,26 +16,10 @@ import (
 	"time"
 )
 
-var (
+const (
 	USER_HEADER_IMG_PATH string = "http://qmplusimg.henrongyi.top"
 	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
 // @Summary 用户注册账号
 // @Produce  application/json
@@ -43,7 +27,7 @@ type RegestStuct struct {
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"注册成功"}"
 // @Router /base/register [post]
 func Register(c *gin.Context) {
-	var R RegestStuct
+	var R model.RegisterStruct
 	_ = c.ShouldBindJSON(&R)
 	user := &model.SysUser{Username: R.Username, NickName: R.NickName, Password: R.Password, HeaderImg: R.HeaderImg, AuthorityId: R.AuthorityId}
 	err, user := user.Register()
@@ -61,11 +45,11 @@ func Register(c *gin.Context) {
 // @Tags Base
 // @Summary 用户登录
 // @Produce  application/json
-// @Param data body api.RegisterAndLoginStuct true "用户登录接口"
+// @Param data body api.RegisterAndLoginStruct true "用户登录接口"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"登陆成功"}"
 // @Router /base/login [post]
 func Login(c *gin.Context) {
-	var L RegisterAndLoginStuct
+	var L model.RegisterAndLoginStruct
 	_ = c.ShouldBindJSON(&L)
 	if captcha.VerifyString(L.CaptchaId, L.Captcha) {
 		U := &model.SysUser{Username: L.Username, Password: L.Password}

+ 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/getFileList', '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', '/jwt/jsonInBlacklist', '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/getFileList', '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', '/jwt/jsonInBlacklist', '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/getFileList', '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/casbinTest/:pathParam', 'GET', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '888', '/jwt/jsonInBlacklist', 'POST', '', '', '');

+ 4 - 4
server/db/qmplus.sql

@@ -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/getFileList', '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', '/jwt/jsonInBlacklist', '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/getFileList', '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', '/jwt/jsonInBlacklist', '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/getFileList', '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/casbinTest/:pathParam', 'GET', '', '', '');
 INSERT INTO `casbin_rule` VALUES ('p', '888', '/jwt/jsonInBlacklist', 'POST', '', '', '');
@@ -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 (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 (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 (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');

+ 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 (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 (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 (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');

+ 5 - 5
server/docs/docs.go

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

+ 5 - 5
server/docs/swagger.json

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

+ 5 - 5
server/docs/swagger.yaml

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

+ 31 - 6
server/model/exa_breakpoint_continue.go

@@ -5,7 +5,7 @@ import (
 	"github.com/jinzhu/gorm"
 )
 
-//文件结构体
+// file struct, 文件结构体
 type ExaFile struct {
 	gorm.Model
 	FileName     string
@@ -16,7 +16,7 @@ type ExaFile struct {
 	IsFinish     bool
 }
 
-//切片结构体
+// file chunk struct, 切片结构体
 type ExaFileChunk struct {
 	gorm.Model
 	ExaFileId       uint
@@ -24,7 +24,13 @@ type ExaFileChunk struct {
 	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 {
 	var file ExaFile
 	upDateFile := make(map[string]interface{})
@@ -34,7 +40,15 @@ func (f *ExaFile) FileCreateComplete(FileMd5 string, FileName string, FilePath s
 	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) {
 	var cfile ExaFile
 	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 {
 	var chunk ExaFileChunk
 	chunk.FileChunkPath = FileChunkPath
@@ -62,7 +81,13 @@ func (f *ExaFile) CreateFileChunk(FileChunkPath string, FileChunkNumber int) 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 {
 	var chunks []ExaFileChunk
 	var file ExaFile

+ 33 - 6
server/model/exa_customer.go

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

+ 28 - 1
server/model/exa_file_upload_download.go

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

+ 53 - 8
server/model/sys_api.go

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

+ 50 - 2
server/model/sys_authority.go

@@ -18,12 +18,25 @@ type SysAuthority struct {
 	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) {
 	err = global.GVA_DB.Create(a).Error
 	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) {
 	err = global.GVA_DB.Where("authority_id = ?", a.AuthorityId).Find(&SysUser{}).Error
@@ -31,7 +44,7 @@ func (a *SysAuthority) DeleteAuthority() (err error) {
 		err = global.GVA_DB.Where("parent_id = ?", a.AuthorityId).Find(&SysAuthority{}).Error
 		if err != nil {
 			err = global.GVA_DB.Where("authority_id = ?", a.AuthorityId).First(a).Unscoped().Delete(a).Error
-			new(CasbinModel).clearCasbin(0, a.AuthorityId)
+			new(CasbinModel).ClearCasbin(0, a.AuthorityId)
 		} else {
 			err = errors.New("此角色存在子角色不允许删除")
 		}
@@ -41,6 +54,13 @@ func (a *SysAuthority) DeleteAuthority() (err error) {
 	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) {
 	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) {
 	err = global.GVA_DB.Preload("DataAuthorityId").Where("parent_id = ?", authority.AuthorityId).Find(&authority.Children).Error
 	if len(authority.Children) > 0 {
@@ -70,6 +97,13 @@ func findChildrenAuthority(authority *SysAuthority) (err error) {
 	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 {
 	var s SysAuthority
 	global.GVA_DB.Preload("DataAuthorityId").First(&s, "authority_id = ?", a.AuthorityId)
@@ -77,6 +111,13 @@ func (a *SysAuthority) SetDataAuthority() error {
 	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 {
 	var s SysAuthority
 	global.GVA_DB.Preload("SysBaseMenus").First(&s, "authority_id = ?", a.AuthorityId)
@@ -84,6 +125,13 @@ func (a *SysAuthority) SetMuneAuthority() error {
 	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) {
 	err = global.GVA_DB.Preload("DataAuthorityId").Where("authority_id = ?", a.AuthorityId).First(&sa).Error
 	return err, sa

+ 24 - 4
server/model/sys_authority_menu.go

@@ -5,7 +5,6 @@ import (
 	"gin-vue-admin/global"
 )
 
-// menu需要构建的点有点多 这里关联关系表直接把所有数据拿过来 用代码实现关联  后期实现主外键模式
 type SysMenu struct {
 	SysBaseMenu
 	MenuId      string    `json:"menuId"`
@@ -13,7 +12,13 @@ type SysMenu struct {
 	Children    []SysMenu `json:"children"`
 }
 
-// 为角色增加menu树
+// @title    AddMenuAuthority
+// @description   为角色增加menu树
+// @auth                     (2020/04/05  20:22 )
+// @param     FileMd5         string
+// @param     FileName        string
+// @param     FilePath        string
+// @return                    error
 func (m *SysMenu) AddMenuAuthority(menus []SysBaseMenu, authorityId string) (err error) {
 	var menu SysMenu
 	global.GVA_DB.Where("authority_id = ? ", authorityId).Unscoped().Delete(&SysMenu{})
@@ -34,13 +39,23 @@ func (m *SysMenu) AddMenuAuthority(menus []SysBaseMenu, authorityId string) (err
 	return nil
 }
 
-// 查看当前角色树
+// @title    GetMenuAuthority
+// @description   查看当前角色树
+// @auth                     (2020/04/05  20:22 )
+// @param     FileMd5         string
+// @param     FileName        string
+// @param     FilePath        string
+// @return                    error
 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    GetMenuTree
+// @description   获取动态菜单树
+// @auth                     (2020/04/05  20:22 )
+// @param     newPassword     string
+// @return    err             error
 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
 	for i := 0; i < len(menus); i++ {
@@ -49,6 +64,11 @@ func (m *SysMenu) GetMenuTree(authorityId string) (err error, menus []SysMenu) {
 	return err, menus
 }
 
+// @title    getChildrenList
+// @description   获取子菜单
+// @auth                     (2020/04/05  20:22 )
+// @param     newPassword     string
+// @return    err             error
 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
 	for i := 0; i < len(menu.Children); i++ {

+ 10 - 1
server/model/sys_auto_code.go

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

+ 35 - 5
server/model/sys_base_menu.go

@@ -27,6 +27,11 @@ type Meta struct {
 	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) {
 	findOne := global.GVA_DB.Where("name = ?", b.Name).Find(&SysBaseMenu{}).Error
@@ -39,7 +44,11 @@ func (b *SysBaseMenu) AddBaseMenu() (err error) {
 	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) {
 	err = global.GVA_DB.Where("parent_id = ?", id).First(&SysBaseMenu{}).Error
 	if err != nil {
@@ -51,7 +60,11 @@ func (b *SysBaseMenu) DeleteBaseMenu(id float64) (err error) {
 	return err
 }
 
-//更新路由
+// @title    UpdateBaseMenu
+// @description   更新路由
+// @auth                     (2020/04/05  20:22 )
+// @param     newPassword     string
+// @return    err             error
 func (b *SysBaseMenu) UpdateBaseMenu() (err error) {
 	upDateMap := make(map[string]interface{})
 	upDateMap["parent_id"] = b.ParentId
@@ -69,13 +82,21 @@ func (b *SysBaseMenu) UpdateBaseMenu() (err error) {
 	return err
 }
 
-//当前选中角色所拥有的路由
+// @title    GetBaseMenuById
+// @description   当前选中角色所拥有的路由
+// @auth                     (2020/04/05  20:22 )
+// @param     newPassword     string
+// @return    err             error
 func (b *SysBaseMenu) GetBaseMenuById(id float64) (err error, menu SysBaseMenu) {
 	err = global.GVA_DB.Where("id = ?", id).First(&menu).Error
 	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) {
 	limit := info.PageSize
 	offset := info.PageSize * (info.Page - 1)
@@ -92,7 +113,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) {
 	err = global.GVA_DB.Where(" parent_id = ?", 0).Order("sort", true).Find(&menus).Error
 	for i := 0; i < len(menus); i++ {
@@ -101,6 +126,11 @@ func (m *SysBaseMenu) GetBaseMenuTree() (err error, menus []SysBaseMenu) {
 	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) {
 	err = global.GVA_DB.Where("parent_id = ?", menu.ID).Order("sort", true).Find(&menu.Children).Error
 	for i := 0; i < len(menu.Children); i++ {

+ 50 - 15
server/model/sys_casbin.go

@@ -29,14 +29,19 @@ type CasbinInReceive struct {
 	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 {
 		cm := CasbinModel{
 			ID:          0,
 			Ptype:       "p",
-			AuthorityId: AuthorityId,
+			AuthorityId: authorityId,
 			Path:        v.Path,
 			Method:      v.Method,
 		}
@@ -48,45 +53,73 @@ func (c *CasbinModel) CasbinPUpdate(AuthorityId string, casbinInfos []CasbinInfo
 	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
 	err := global.GVA_DB.Table("casbin_rule").Where("v1 = ?", oldPath).Find(&cs).Update("v1", newPath).Error
 	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 {
 	e := Casbin()
 	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()
 	var pathList []string
-	list := e.GetFilteredPolicy(0, AuthorityId)
+	list := e.GetFilteredPolicy(0, authorityId)
 	for _, v := range list {
 		pathList = append(pathList, v[1])
 	}
 	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()
 	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 {
 	key1 := strings.Split(fullNameKey1, "?")[0]
 	//剥离路径后再使用casbin的keyMatch2
 	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) {
 	name1 := args[0].(string)
 	name2 := args[1].(string)
@@ -94,7 +127,9 @@ func ParamsMatchFunc(args ...interface{}) (interface{}, error) {
 	return (bool)(ParamsMatch(name1, name2)), nil
 }
 
-//持久化到数据库  引入自定义规则
+// @title    Casbin
+// @description   持久化到数据库  引入自定义规则
+// @auth                     (2020/04/05  20:22 )
 func Casbin() *casbin.Enforcer {
 	a := gormadapter.NewAdapterByDB(global.GVA_DB)
 	e := casbin.NewEnforcer(global.GVA_CONFIG.Casbin.ModelPath, a)

+ 19 - 3
server/model/sys_jwt_blacklist.go

@@ -10,24 +10,40 @@ type JwtBlacklist struct {
 	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) {
 	err = global.GVA_DB.Create(j).Error
 	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 {
 	isNotFound := global.GVA_DB.Where("jwt = ?", Jwt).First(j).RecordNotFound()
 	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) {
 	RedisJWT, err = global.GVA_REDIS.Get(userName).Result()
 	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) {
 	err = global.GVA_REDIS.Set(userName, j.Jwt, 1000*1000*1000*60*60*24*7).Err()
 	return err

+ 9 - 2
server/model/sys_system.go

@@ -11,12 +11,19 @@ type System struct {
 	Config config.Server
 }
 
-//读取配置文件
+// @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
 }
 
-//设置配置文件
+// @title    SetSystemConfig
+// @description   set system config, 设置配置文件
+// @auth                     (2020/04/05  20:22 )
+// @return    err              error
 func (s *System) SetSystemConfig() (err error) {
 	confs := utils.StructToMap(s.Config)
 	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"`
 }
 
-//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) {
 	var user SysUser
 	//判断用户名是否注册
@@ -40,7 +55,12 @@ func (u *SysUser) Register() (err error, userInter *SysUser) {
 	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) {
 	var user SysUser
 	//后期修改jwt+password模式
@@ -49,13 +69,22 @@ func (u *SysUser) ChangePassword(newPassword string) (err error, userInter *SysU
 	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
 }
 
-//用户登录
+// @title    Login
+// @description   login, 用户登录
+// @auth                     (2020/04/05  20:22 )
+// @return    err             error
+// @return    userInter       *SysUser
 func (u *SysUser) Login() (err error, userInter *SysUser) {
 	var user SysUser
 	u.Password = utils.MD5V([]byte(u.Password))
@@ -67,14 +96,26 @@ func (u *SysUser) Login() (err error, userInter *SysUser) {
 	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) {
 	var user SysUser
 	err = global.GVA_DB.Where("uuid = ?", uuid).First(&user).Update("header_img", filePath).First(&user).Error
 	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) {
 	limit := info.PageSize
 	offset := info.PageSize * (info.Page - 1)

+ 4 - 1
server/model/sys_workflow.go

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

+ 1 - 1
server/router/sys_casbin.go

@@ -9,7 +9,7 @@ import (
 func InitCasbinRouter(Router *gin.RouterGroup) {
 	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.GET("casbinTest/:pathParam", v1.CasbinTest)
 	}

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

@@ -7,11 +7,11 @@ import service from '@/utils/request'
 // @Produce application/json
 // @Param data body api.CreateAuthorityPatams true "更改角色api权限"
 // @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({
-        url: "/casbin/casbinPUpdate",
+        url: "/casbin/UpdateCasbin",
         method: 'post',
         data
     })

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

@@ -17,7 +17,7 @@
 </template>
 <script>
 import { getAllApis } from '@/api/api'
-import { casbinPUpdate, getPolicyPathByAuthorityId } from '@/api/casbin'
+import { UpdateCasbin, getPolicyPathByAuthorityId } from '@/api/casbin'
 export default {
   name: 'Apis',
   props: {
@@ -72,7 +72,7 @@ export default {
         }
         casbinInfos.push(casbinInfo)
       })
-      const res = await casbinPUpdate({
+      const res = await UpdateCasbin({
         authorityId: this.activeUserId,
         casbinInfos
       })