Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FLIPPED-AURORA
gin-vue-admin
提交
e1958efb
G
gin-vue-admin
项目概览
FLIPPED-AURORA
/
gin-vue-admin
大约 1 年 前同步成功
通知
342
Star
18155
Fork
5506
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gin-vue-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
e1958efb
编写于
12月 23, 2019
作者:
G
Grant
提交者:
GitHub
12月 23, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1 from piexlmax/master
update
上级
77a1ff1d
ca396b1f
变更
37
隐藏空白更改
内联
并排
Showing
37 changed file
with
234 addition
and
143 deletion
+234
-143
QMPlusServer/controller/api/exa_fileUploadAndDownload.go
QMPlusServer/controller/api/exa_fileUploadAndDownload.go
+5
-5
QMPlusServer/controller/api/sys_api.go
QMPlusServer/controller/api/sys_api.go
+3
-3
QMPlusServer/controller/api/sys_authority.go
QMPlusServer/controller/api/sys_authority.go
+5
-5
QMPlusServer/controller/api/sys_casbin.go
QMPlusServer/controller/api/sys_casbin.go
+4
-4
QMPlusServer/controller/api/sys_menu.go
QMPlusServer/controller/api/sys_menu.go
+4
-4
QMPlusServer/controller/api/sys_user.go
QMPlusServer/controller/api/sys_user.go
+10
-10
QMPlusServer/controller/api/sys_workFlow.go
QMPlusServer/controller/api/sys_workFlow.go
+2
-2
QMPlusServer/controller/servers/paging.go
QMPlusServer/controller/servers/paging.go
+2
-2
QMPlusServer/controller/servers/reportformat.go
QMPlusServer/controller/servers/reportformat.go
+1
-1
QMPlusServer/docs/docs.go
QMPlusServer/docs/docs.go
+41
-6
QMPlusServer/docs/swagger.json
QMPlusServer/docs/swagger.json
+40
-5
QMPlusServer/docs/swagger.yaml
QMPlusServer/docs/swagger.yaml
+28
-5
QMPlusServer/go.mod
QMPlusServer/go.mod
+1
-1
QMPlusServer/init/initRouter/init_router.go
QMPlusServer/init/initRouter/init_router.go
+3
-3
QMPlusServer/init/qmlog/qmlog.go
QMPlusServer/init/qmlog/qmlog.go
+4
-3
QMPlusServer/init/qmsql/initMysql.go
QMPlusServer/init/qmsql/initMysql.go
+1
-1
QMPlusServer/init/registTable/regist_table.go
QMPlusServer/init/registTable/regist_table.go
+2
-2
QMPlusServer/main.go
QMPlusServer/main.go
+11
-12
QMPlusServer/middleware/casbin_rcba.go
QMPlusServer/middleware/casbin_rcba.go
+3
-3
QMPlusServer/middleware/jwt.go
QMPlusServer/middleware/jwt.go
+1
-1
QMPlusServer/middleware/logger.go
QMPlusServer/middleware/logger.go
+1
-1
QMPlusServer/model/dbModel/exa_fileUploadAndDownload.go
QMPlusServer/model/dbModel/exa_fileUploadAndDownload.go
+3
-3
QMPlusServer/model/sysModel/sys_api.go
QMPlusServer/model/sysModel/sys_api.go
+9
-9
QMPlusServer/model/sysModel/sys_authority.go
QMPlusServer/model/sysModel/sys_authority.go
+3
-3
QMPlusServer/model/sysModel/sys_base_menu.go
QMPlusServer/model/sysModel/sys_base_menu.go
+3
-3
QMPlusServer/model/sysModel/sys_casbin.go
QMPlusServer/model/sysModel/sys_casbin.go
+19
-21
QMPlusServer/model/sysModel/sys_menu_authority.go
QMPlusServer/model/sysModel/sys_menu_authority.go
+1
-1
QMPlusServer/model/sysModel/sys_user.go
QMPlusServer/model/sysModel/sys_user.go
+6
-6
QMPlusServer/model/sysModel/sys_worfFlow.go
QMPlusServer/model/sysModel/sys_worfFlow.go
+3
-3
QMPlusServer/router/exp_fileUploadAndDownload.go
QMPlusServer/router/exp_fileUploadAndDownload.go
+2
-2
QMPlusServer/router/sys_api.go
QMPlusServer/router/sys_api.go
+2
-2
QMPlusServer/router/sys_authority.go
QMPlusServer/router/sys_authority.go
+2
-2
QMPlusServer/router/sys_base.go
QMPlusServer/router/sys_base.go
+1
-1
QMPlusServer/router/sys_casbin.go
QMPlusServer/router/sys_casbin.go
+2
-2
QMPlusServer/router/sys_menu.go
QMPlusServer/router/sys_menu.go
+2
-2
QMPlusServer/router/sys_user.go
QMPlusServer/router/sys_user.go
+2
-2
QMPlusServer/router/sys_workflow.go
QMPlusServer/router/sys_workflow.go
+2
-2
未找到文件。
QMPlusServer/controller/api/exa_fileUploadAndDownload.go
浏览文件 @
e1958efb
...
...
@@ -2,10 +2,10 @@ package api
import
(
"fmt"
"gin-vue-admin/controller/servers"
"gin-vue-admin/model/dbModel"
"gin-vue-admin/model/modelInterface"
"github.com/gin-gonic/gin"
"main/controller/servers"
"main/model/dbModel"
"main/model/modelInterface"
"strings"
)
...
...
@@ -18,7 +18,7 @@ import (
// @Success 200 {string} string "{"success":true,"data":{},"msg":"上传成功"}"
// @Router /fileUploadAndDownload/upload [post]
func
UploadFile
(
c
*
gin
.
Context
)
{
noSave
:=
c
.
DefaultQuery
(
"noSave"
,
"0"
)
noSave
:=
c
.
DefaultQuery
(
"noSave"
,
"0"
)
_
,
header
,
err
:=
c
.
Request
.
FormFile
(
"file"
)
if
err
!=
nil
{
servers
.
ReportFormat
(
c
,
false
,
fmt
.
Sprintf
(
"上传文件失败,%v"
,
err
),
gin
.
H
{})
...
...
@@ -35,7 +35,7 @@ func UploadFile(c *gin.Context) {
s
:=
strings
.
Split
(
file
.
Name
,
"."
)
file
.
Tag
=
s
[
len
(
s
)
-
1
]
file
.
Key
=
key
if
(
noSave
==
"0"
)
{
if
noSave
==
"0"
{
err
=
file
.
Upload
()
}
if
err
!=
nil
{
...
...
QMPlusServer/controller/api/sys_api.go
浏览文件 @
e1958efb
...
...
@@ -2,10 +2,10 @@ package api
import
(
"fmt"
"gin-vue-admin/controller/servers"
"gin-vue-admin/model/modelInterface"
"gin-vue-admin/model/sysModel"
"github.com/gin-gonic/gin"
"main/controller/servers"
"main/model/modelInterface"
"main/model/sysModel"
)
type
CreateApiParams
struct
{
...
...
QMPlusServer/controller/api/sys_authority.go
浏览文件 @
e1958efb
...
...
@@ -2,13 +2,13 @@ package api
import
(
"fmt"
"gin-vue-admin/controller/servers"
"gin-vue-admin/model/modelInterface"
"gin-vue-admin/model/sysModel"
"github.com/gin-gonic/gin"
"main/controller/servers"
"main/model/modelInterface"
"main/model/sysModel"
)
type
CreateAuthorityPa
t
ams
struct
{
type
CreateAuthorityPa
r
ams
struct
{
AuthorityId
string
`json:"authorityId"`
AuthorityName
string
`json:"authorityName"`
}
...
...
@@ -18,7 +18,7 @@ type CreateAuthorityPatams struct {
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body api.CreateAuthorityPa
t
ams true "创建角色"
// @Param data body api.CreateAuthorityPa
r
ams true "创建角色"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /authority/createAuthority [post]
func
CreateAuthority
(
c
*
gin
.
Context
)
{
...
...
QMPlusServer/controller/api/sys_casbin.go
浏览文件 @
e1958efb
...
...
@@ -2,9 +2,9 @@ package api
import
(
"fmt"
"gin-vue-admin/controller/servers"
"gin-vue-admin/model/sysModel"
"github.com/gin-gonic/gin"
"main/controller/servers"
"main/model/sysModel"
)
type
CasbinInReceive
struct
{
...
...
@@ -17,7 +17,7 @@ type CasbinInReceive struct {
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body api.CreateAuthorityPa
t
ams true "更改角色api权限"
// @Param data body api.CreateAuthorityPa
r
ams true "更改角色api权限"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /casbin/casbinPUpdata [post]
func
CasbinPUpdata
(
c
*
gin
.
Context
)
{
...
...
@@ -36,7 +36,7 @@ func CasbinPUpdata(c *gin.Context) {
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body api.CreateAuthorityPa
t
ams true "获取权限列表"
// @Param data body api.CreateAuthorityPa
r
ams true "获取权限列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /casbin/getPolicyPathByAuthorityId [post]
func
GetPolicyPathByAuthorityId
(
c
*
gin
.
Context
)
{
...
...
QMPlusServer/controller/api/sys_menu.go
浏览文件 @
e1958efb
...
...
@@ -2,11 +2,11 @@ package api
import
(
"fmt"
"gin-vue-admin/controller/servers"
"gin-vue-admin/middleware"
"gin-vue-admin/model/modelInterface"
"gin-vue-admin/model/sysModel"
"github.com/gin-gonic/gin"
"main/controller/servers"
"main/middleware"
"main/model/modelInterface"
"main/model/sysModel"
)
// @Tags authorityAndMenu
...
...
QMPlusServer/controller/api/sys_user.go
浏览文件 @
e1958efb
...
...
@@ -2,13 +2,13 @@ package api
import
(
"fmt"
"gin-vue-admin/controller/servers"
"gin-vue-admin/middleware"
"gin-vue-admin/model/modelInterface"
"gin-vue-admin/model/sysModel"
"github.com/dgrijalva/jwt-go"
"github.com/gin-gonic/gin"
uuid
"github.com/satori/go.uuid"
"main/controller/servers"
"main/middleware"
"main/model/modelInterface"
"main/model/sysModel"
"mime/multipart"
"time"
)
...
...
@@ -24,11 +24,11 @@ type RegistAndLoginStuct struct {
}
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"`
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
...
...
@@ -40,7 +40,7 @@ type RegestStuct struct {
func
Regist
(
c
*
gin
.
Context
)
{
var
R
RegestStuct
_
=
c
.
BindJSON
(
&
R
)
user
:=
&
sysModel
.
SysUser
{
Username
:
R
.
Username
,
NickName
:
R
.
NickName
,
Password
:
R
.
Password
,
HeaderImg
:
R
.
HeaderImg
,
AuthorityId
:
R
.
AuthorityId
}
user
:=
&
sysModel
.
SysUser
{
Username
:
R
.
Username
,
NickName
:
R
.
NickName
,
Password
:
R
.
Password
,
HeaderImg
:
R
.
HeaderImg
,
AuthorityId
:
R
.
AuthorityId
}
err
,
user
:=
user
.
Regist
()
if
err
!=
nil
{
servers
.
ReportFormat
(
c
,
false
,
fmt
.
Sprintf
(
"%v"
,
err
),
gin
.
H
{
...
...
QMPlusServer/controller/api/sys_workFlow.go
浏览文件 @
e1958efb
...
...
@@ -2,9 +2,9 @@ package api
import
(
"fmt"
"gin-vue-admin/controller/servers"
"gin-vue-admin/model/sysModel"
"github.com/gin-gonic/gin"
"main/controller/servers"
"main/model/sysModel"
)
// @Tags workflow
...
...
QMPlusServer/controller/servers/paging.go
浏览文件 @
e1958efb
package
servers
import
(
"gin-vue-admin/init/qmsql"
"gin-vue-admin/model/modelInterface"
"github.com/jinzhu/gorm"
"main/init/qmsql"
"main/model/modelInterface"
)
//获取分页功能 接收实现了分页接口的结构体 返回搜索完成的结果 许需要自行scan 或者find
...
...
QMPlusServer/controller/servers/reportformat.go
浏览文件 @
e1958efb
package
servers
import
(
"gin-vue-admin/init/qmlog"
"github.com/gin-gonic/gin"
"main/init/qmlog"
"net/http"
"time"
)
...
...
QMPlusServer/docs/docs.go
浏览文件 @
e1958efb
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag at
// 2019-12-
13 14:31:12.9298434 +0800 CST m=+0.056881
601
// 2019-12-
20 11:36:51.4275267 +0800 CST m=+0.082812
601
package
docs
...
...
@@ -273,7 +273,7 @@ var doc = `{
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/api.CreateAuthorityPa
t
ams"
"$ref": "#/definitions/api.CreateAuthorityPa
r
ams"
}
}
],
...
...
@@ -413,7 +413,7 @@ var doc = `{
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/
api.RegistAndLoginStuct
"
"$ref": "#/definitions/
sysModel.SysUser
"
}
}
],
...
...
@@ -452,7 +452,7 @@ var doc = `{
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/api.CreateAuthorityPa
t
ams"
"$ref": "#/definitions/api.CreateAuthorityPa
r
ams"
}
}
],
...
...
@@ -491,7 +491,7 @@ var doc = `{
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/api.CreateAuthorityPa
t
ams"
"$ref": "#/definitions/api.CreateAuthorityPa
r
ams"
}
}
],
...
...
@@ -1159,7 +1159,7 @@ var doc = `{
}
}
},
"api.CreateAuthorityPa
t
ams": {
"api.CreateAuthorityPa
r
ams": {
"type": "object",
"properties": {
"authorityId": {
...
...
@@ -1258,6 +1258,17 @@ var doc = `{
}
}
},
"sysModel.SysAuthority": {
"type": "object",
"properties": {
"authorityId": {
"type": "string"
},
"authorityName": {
"type": "string"
}
}
},
"sysModel.SysBaseMenu": {
"type": "object",
"properties": {
...
...
@@ -1296,6 +1307,30 @@ var doc = `{
}
}
},
"sysModel.SysUser": {
"type": "object",
"properties": {
"authority": {
"type": "object",
"$ref": "#/definitions/sysModel.SysAuthority"
},
"authorityId": {
"type": "string"
},
"headerImg": {
"type": "string"
},
"nickName": {
"type": "string"
},
"userName": {
"type": "string"
},
"uuid": {
"type": "string"
}
}
},
"sysModel.SysWorkflow": {
"type": "object",
"properties": {
...
...
QMPlusServer/docs/swagger.json
浏览文件 @
e1958efb
...
...
@@ -256,7 +256,7 @@
"required"
:
true
,
"schema"
:
{
"type"
:
"object"
,
"$ref"
:
"#/definitions/api.CreateAuthorityPa
t
ams"
"$ref"
:
"#/definitions/api.CreateAuthorityPa
r
ams"
}
}
],
...
...
@@ -396,7 +396,7 @@
"required"
:
true
,
"schema"
:
{
"type"
:
"object"
,
"$ref"
:
"#/definitions/
api.RegistAndLoginStuct
"
"$ref"
:
"#/definitions/
sysModel.SysUser
"
}
}
],
...
...
@@ -435,7 +435,7 @@
"required"
:
true
,
"schema"
:
{
"type"
:
"object"
,
"$ref"
:
"#/definitions/api.CreateAuthorityPa
t
ams"
"$ref"
:
"#/definitions/api.CreateAuthorityPa
r
ams"
}
}
],
...
...
@@ -474,7 +474,7 @@
"required"
:
true
,
"schema"
:
{
"type"
:
"object"
,
"$ref"
:
"#/definitions/api.CreateAuthorityPa
t
ams"
"$ref"
:
"#/definitions/api.CreateAuthorityPa
r
ams"
}
}
],
...
...
@@ -1142,7 +1142,7 @@
}
}
},
"api.CreateAuthorityPa
t
ams"
:
{
"api.CreateAuthorityPa
r
ams"
:
{
"type"
:
"object"
,
"properties"
:
{
"authorityId"
:
{
...
...
@@ -1241,6 +1241,17 @@
}
}
},
"sysModel.SysAuthority"
:
{
"type"
:
"object"
,
"properties"
:
{
"authorityId"
:
{
"type"
:
"string"
},
"authorityName"
:
{
"type"
:
"string"
}
}
},
"sysModel.SysBaseMenu"
:
{
"type"
:
"object"
,
"properties"
:
{
...
...
@@ -1279,6 +1290,30 @@
}
}
},
"sysModel.SysUser"
:
{
"type"
:
"object"
,
"properties"
:
{
"authority"
:
{
"type"
:
"object"
,
"$ref"
:
"#/definitions/sysModel.SysAuthority"
},
"authorityId"
:
{
"type"
:
"string"
},
"headerImg"
:
{
"type"
:
"string"
},
"nickName"
:
{
"type"
:
"string"
},
"userName"
:
{
"type"
:
"string"
},
"uuid"
:
{
"type"
:
"string"
}
}
},
"sysModel.SysWorkflow"
:
{
"type"
:
"object"
,
"properties"
:
{
...
...
QMPlusServer/docs/swagger.yaml
浏览文件 @
e1958efb
...
...
@@ -30,7 +30,7 @@ definitions:
path
:
type
:
string
type
:
object
api.CreateAuthorityPa
t
ams
:
api.CreateAuthorityPa
r
ams
:
properties
:
authorityId
:
type
:
string
...
...
@@ -93,6 +93,13 @@ definitions:
path
:
type
:
string
type
:
object
sysModel.SysAuthority
:
properties
:
authorityId
:
type
:
string
authorityName
:
type
:
string
type
:
object
sysModel.SysBaseMenu
:
properties
:
children
:
...
...
@@ -118,6 +125,22 @@ definitions:
title
:
type
:
string
type
:
object
sysModel.SysUser
:
properties
:
authority
:
$ref
:
'
#/definitions/sysModel.SysAuthority'
type
:
object
authorityId
:
type
:
string
headerImg
:
type
:
string
nickName
:
type
:
string
userName
:
type
:
string
uuid
:
type
:
string
type
:
object
sysModel.SysWorkflow
:
properties
:
workflowDescription
:
...
...
@@ -309,7 +332,7 @@ paths:
name
:
data
required
:
true
schema
:
$ref
:
'
#/definitions/api.CreateAuthorityPa
t
ams'
$ref
:
'
#/definitions/api.CreateAuthorityPa
r
ams'
type
:
object
produces
:
-
application/json
...
...
@@ -399,7 +422,7 @@ paths:
name
:
data
required
:
true
schema
:
$ref
:
'
#/definitions/
api.RegistAndLoginStuct
'
$ref
:
'
#/definitions/
sysModel.SysUser
'
type
:
object
produces
:
-
application/json
...
...
@@ -421,7 +444,7 @@ paths:
name
:
data
required
:
true
schema
:
$ref
:
'
#/definitions/api.CreateAuthorityPa
t
ams'
$ref
:
'
#/definitions/api.CreateAuthorityPa
r
ams'
type
:
object
produces
:
-
application/json
...
...
@@ -445,7 +468,7 @@ paths:
name
:
data
required
:
true
schema
:
$ref
:
'
#/definitions/api.CreateAuthorityPa
t
ams'
$ref
:
'
#/definitions/api.CreateAuthorityPa
r
ams'
type
:
object
produces
:
-
application/json
...
...
QMPlusServer/go.mod
浏览文件 @
e1958efb
module
ma
in
module
gin-vue-adm
in
go 1.12
...
...
QMPlusServer/init/initRouter/init_router.go
浏览文件 @
e1958efb
package
initRouter
import
(
_
"gin-vue-admin/docs"
"gin-vue-admin/middleware"
"gin-vue-admin/router"
"github.com/gin-gonic/gin"
"github.com/swaggo/gin-swagger"
"github.com/swaggo/gin-swagger/swaggerFiles"
_
"main/docs"
"main/middleware"
"main/router"
)
//初始化总路由
...
...
QMPlusServer/init/qmlog/qmlog.go
浏览文件 @
e1958efb
...
...
@@ -3,17 +3,18 @@ package qmlog
// 日志初始化包 调用qmlog.QMLog.Info 记录日志 24小时切割 日志保存7天 可自行设置
import
(
"fmt"
"gin-vue-admin/tools"
rotatelogs
"github.com/lestrrat/go-file-rotatelogs"
"github.com/rifflock/lfshook"
"github.com/sirupsen/logrus"
"main/tools"
"os"
"time"
)
var
QMLog
=
logrus
.
New
()
//禁止logrus的输出
func
InitLog
()
*
logrus
.
Logger
{
func
InitLog
()
*
logrus
.
Logger
{
src
,
err
:=
os
.
OpenFile
(
os
.
DevNull
,
os
.
O_APPEND
|
os
.
O_WRONLY
,
os
.
ModeAppend
)
if
err
!=
nil
{
fmt
.
Println
(
"err"
,
err
)
...
...
@@ -23,7 +24,7 @@ func InitLog() *logrus.Logger{
if
ok
,
_
:=
tools
.
PathExists
(
"./log"
);
!
ok
{
// Directory not exist
fmt
.
Println
(
"Create log."
)
os
.
Mkdir
(
"log"
,
os
.
ModePerm
)
_
=
os
.
Mkdir
(
"log"
,
os
.
ModePerm
)
}
apiLogPath
:=
"./log/api.log"
logWriter
,
err
:=
rotatelogs
.
New
(
...
...
QMPlusServer/init/qmsql/initMysql.go
浏览文件 @
e1958efb
package
qmsql
import
(
"gin-vue-admin/config"
"github.com/jinzhu/gorm"
_
"github.com/jinzhu/gorm/dialects/mysql"
"log"
"main/config"
)
var
DEFAULTDB
*
gorm
.
DB
...
...
QMPlusServer/init/registTable/regist_table.go
浏览文件 @
e1958efb
package
registTable
import
(
"gin-vue-admin/model/dbModel"
"gin-vue-admin/model/sysModel"
"github.com/jinzhu/gorm"
"main/model/dbModel"
"main/model/sysModel"
)
//注册数据库表专用
...
...
QMPlusServer/main.go
浏览文件 @
e1958efb
...
...
@@ -2,16 +2,15 @@ package main
import
(
"fmt"
"
ma
in/config"
"
ma
in/init/initRouter"
"
ma
in/init/qmlog"
"
ma
in/init/qmsql"
"
ma
in/init/registTable"
"
gin-vue-adm
in/config"
"
gin-vue-adm
in/init/initRouter"
"
gin-vue-adm
in/init/qmlog"
"
gin-vue-adm
in/init/qmsql"
"
gin-vue-adm
in/init/registTable"
"net/http"
"time"
)
// @title Swagger Example API
// @version 0.0.1
// @description This is a sample Server pets
...
...
@@ -21,12 +20,12 @@ import (
// @BasePath /
func
main
()
{
qmlog
.
InitLog
()
// 初始化日志
db
:=
qmsql
.
InitMysql
(
config
.
Dbconfig
.
Admin
)
// 链接初始化数据库
registTable
.
RegistTable
(
db
)
//注册数据库表
defer
qmsql
.
DEFAULTDB
.
Close
()
// 程序结束前关闭数据库链接
Router
:=
initRouter
.
InitRouter
()
//注册路由
qmlog
.
QMLog
.
Info
(
"服务器开启"
)
// 日志测试代码
qmlog
.
InitLog
()
// 初始化日志
db
:=
qmsql
.
InitMysql
(
config
.
Dbconfig
.
Admin
)
// 链接初始化数据库
registTable
.
RegistTable
(
db
)
//注册数据库表
defer
qmsql
.
DEFAULTDB
.
Close
()
// 程序结束前关闭数据库链接
Router
:=
initRouter
.
InitRouter
()
//注册路由
qmlog
.
QMLog
.
Info
(
"服务器开启"
)
// 日志测试代码
//Router.RunTLS(":443","ssl.pem", "ssl.key") // https支持 需要添加中间件
s
:=
&
http
.
Server
{
Addr
:
":8888"
,
...
...
QMPlusServer/middleware/casbin_rcba.go
浏览文件 @
e1958efb
...
...
@@ -2,9 +2,9 @@ package middleware
import
(
"fmt"
"gin-vue-admin/controller/servers"
"gin-vue-admin/model/sysModel"
"github.com/gin-gonic/gin"
"main/controller/servers"
"main/model/sysModel"
)
//拦截器
...
...
@@ -18,7 +18,7 @@ func CasbinHandler() gin.HandlerFunc {
act
:=
c
.
Request
.
Method
//获取用户的角色
sub
:=
waitUse
.
AuthorityId
e
:=
sysModel
.
Casbin
()
e
:=
sysModel
.
Casbin
()
//判断策略中是否存在
if
e
.
Enforce
(
sub
,
obj
,
act
)
{
c
.
Next
()
...
...
QMPlusServer/middleware/jwt.go
浏览文件 @
e1958efb
...
...
@@ -2,10 +2,10 @@ package middleware
import
(
"errors"
"gin-vue-admin/controller/servers"
"github.com/dgrijalva/jwt-go"
"github.com/gin-gonic/gin"
uuid
"github.com/satori/go.uuid"
"main/controller/servers"
"time"
)
...
...
QMPlusServer/middleware/logger.go
浏览文件 @
e1958efb
package
middleware
import
(
"gin-vue-admin/init/qmlog"
"github.com/gin-gonic/gin"
"main/init/qmlog"
"time"
)
...
...
QMPlusServer/model/dbModel/exa_fileUploadAndDownload.go
浏览文件 @
e1958efb
package
dbModel
import
(
"gin-vue-admin/controller/servers"
"gin-vue-admin/init/qmsql"
"gin-vue-admin/model/modelInterface"
"github.com/jinzhu/gorm"
"main/controller/servers"
"main/init/qmsql"
"main/model/modelInterface"
)
type
ExaFileUploadAndDownload
struct
{
...
...
QMPlusServer/model/sysModel/sys_api.go
浏览文件 @
e1958efb
package
sysModel
import
(
"gin-vue-admin/controller/servers"
"gin-vue-admin/init/qmsql"
"gin-vue-admin/model/modelInterface"
"github.com/jinzhu/gorm"
"github.com/pkg/errors"
"main/controller/servers"
"main/init/qmsql"
"main/model/modelInterface"
)
type
SysApi
struct
{
...
...
@@ -27,20 +27,20 @@ func (a *SysApi) CreateApi() (err error) {
func
(
a
*
SysApi
)
DeleteApi
()
(
err
error
)
{
err
=
qmsql
.
DEFAULTDB
.
Delete
(
a
)
.
Error
new
(
CasbinModel
)
.
clearCasbin
(
1
,
a
.
Path
)
new
(
CasbinModel
)
.
clearCasbin
(
1
,
a
.
Path
)
return
err
}
func
(
a
*
SysApi
)
UpdataApi
()
(
err
error
)
{
var
oldA
SysApi
err
=
qmsql
.
DEFAULTDB
.
Where
(
"id = ?"
,
a
.
ID
)
.
First
(
&
oldA
)
.
Error
if
(
err
!=
nil
)
{
if
err
!=
nil
{
return
err
}
else
{
err
=
new
(
CasbinModel
)
.
CasbinApiUpdata
(
oldA
.
Path
,
a
.
Path
)
if
(
err
!=
nil
)
{
}
else
{
err
=
new
(
CasbinModel
)
.
CasbinApiUpdata
(
oldA
.
Path
,
a
.
Path
)
if
err
!=
nil
{
return
err
}
else
{
}
else
{
err
=
qmsql
.
DEFAULTDB
.
Save
(
a
)
.
Error
}
}
...
...
QMPlusServer/model/sysModel/sys_authority.go
浏览文件 @
e1958efb
package
sysModel
import
(
"gin-vue-admin/controller/servers"
"gin-vue-admin/init/qmsql"
"gin-vue-admin/model/modelInterface"
"github.com/jinzhu/gorm"
"github.com/pkg/errors"
"main/controller/servers"
"main/init/qmsql"
"main/model/modelInterface"
)
type
SysAuthority
struct
{
...
...
QMPlusServer/model/sysModel/sys_base_menu.go
浏览文件 @
e1958efb
...
...
@@ -2,11 +2,11 @@ package sysModel
import
(
"fmt"
"gin-vue-admin/controller/servers"
"gin-vue-admin/init/qmsql"
"gin-vue-admin/model/modelInterface"
"github.com/jinzhu/gorm"
"github.com/pkg/errors"
"main/controller/servers"
"main/init/qmsql"
"main/model/modelInterface"
)
type
SysBaseMenu
struct
{
...
...
QMPlusServer/model/sysModel/sys_casbin.go
浏览文件 @
e1958efb
...
...
@@ -2,27 +2,25 @@ package sysModel
import
(
"errors"
"gin-vue-admin/init/qmsql"
"github.com/casbin/casbin"
gormadapter
"github.com/casbin/gorm-adapter"
"main/init/qmsql"
"strings"
)
type
CasbinModel
struct
{
ID
uint
`json:"id" gorm:"column:_id"`
Ptype
string
`json:"ptype" gorm:"column:ptype"`
AuthorityId
string
`json:"rolename" gorm:"column:v0"`
Path
string
`json:"path" gorm:"column:v1"`
Method
string
`json:"method" gorm:"column:v2"`
ID
uint
`json:"id" gorm:"column:_id"`
Ptype
string
`json:"ptype" gorm:"column:ptype"`
AuthorityId
string
`json:"rolename" gorm:"column:v0"`
Path
string
`json:"path" gorm:"column:v1"`
Method
string
`json:"method" gorm:"column:v2"`
}
// 更新权限
func
(
c
*
CasbinModel
)
CasbinPUpdata
(
AuthorityId
string
,
Paths
[]
string
)
error
{
c
.
clearCasbin
(
0
,
AuthorityId
)
for
_
,
v
:=
range
Paths
{
cm
:=
CasbinModel
{
func
(
c
*
CasbinModel
)
CasbinPUpdata
(
AuthorityId
string
,
Paths
[]
string
)
error
{
c
.
clearCasbin
(
0
,
AuthorityId
)
for
_
,
v
:=
range
Paths
{
cm
:=
CasbinModel
{
ID
:
0
,
Ptype
:
"p"
,
AuthorityId
:
AuthorityId
,
...
...
@@ -30,7 +28,7 @@ func (c *CasbinModel) CasbinPUpdata(AuthorityId string,Paths []string)error{
Method
:
"POST"
,
}
addflag
:=
c
.
AddCasbin
(
cm
)
if
(
addflag
==
false
)
{
if
addflag
==
false
{
return
errors
.
New
(
"存在相同api,添加失败,请联系管理员"
)
}
}
...
...
@@ -38,39 +36,39 @@ func (c *CasbinModel) CasbinPUpdata(AuthorityId string,Paths []string)error{
}
// API更新随动
func
(
c
*
CasbinModel
)
CasbinApiUpdata
(
oldPath
string
,
newPath
string
)
error
{
func
(
c
*
CasbinModel
)
CasbinApiUpdata
(
oldPath
string
,
newPath
string
)
error
{
var
cs
[]
CasbinModel
err
:=
qmsql
.
DEFAULTDB
.
Table
(
"casbin_rule"
)
.
Where
(
"v1 = ?"
,
oldPath
)
.
Find
(
&
cs
)
.
Update
(
"v1"
,
newPath
)
.
Error
err
:=
qmsql
.
DEFAULTDB
.
Table
(
"casbin_rule"
)
.
Where
(
"v1 = ?"
,
oldPath
)
.
Find
(
&
cs
)
.
Update
(
"v1"
,
newPath
)
.
Error
return
err
}
//添加权限
func
(
c
*
CasbinModel
)
AddCasbin
(
cm
CasbinModel
)
bool
{
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
{
func
(
c
*
CasbinModel
)
GetPolicyPathByAuthorityId
(
AuthorityId
string
)
[]
string
{
e
:=
Casbin
()
var
pathList
[]
string
list
:=
e
.
GetFilteredPolicy
(
0
,
AuthorityId
)
for
_
,
v
:=
range
list
{
for
_
,
v
:=
range
list
{
pathList
=
append
(
pathList
,
v
[
1
])
}
return
pathList
}
//清除匹配的权限
func
(
c
*
CasbinModel
)
clearCasbin
(
v
int
,
p
string
)
bool
{
func
(
c
*
CasbinModel
)
clearCasbin
(
v
int
,
p
string
)
bool
{
e
:=
Casbin
()
return
e
.
RemoveFilteredPolicy
(
v
,
p
)
return
e
.
RemoveFilteredPolicy
(
v
,
p
)
}
// 自定义规则函数
func
ParamsMatch
(
key1
string
,
key2
string
)
bool
{
k1arr
:=
strings
.
Split
(
key1
,
"?"
)
k1arr
:=
strings
.
Split
(
key1
,
"?"
)
return
k1arr
[
0
]
==
key2
}
...
...
QMPlusServer/model/sysModel/sys_menu_authority.go
浏览文件 @
e1958efb
...
...
@@ -2,7 +2,7 @@ package sysModel
import
(
"fmt"
"
ma
in/init/qmsql"
"
gin-vue-adm
in/init/qmsql"
)
// menu需要构建的点有点多 这里关联关系表直接把所有数据拿过来 用代码实现关联 后期实现主外键模式
...
...
QMPlusServer/model/sysModel/sys_user.go
浏览文件 @
e1958efb
package
sysModel
import
(
"gin-vue-admin/controller/servers"
"gin-vue-admin/init/qmsql"
"gin-vue-admin/model/modelInterface"
"gin-vue-admin/tools"
"github.com/jinzhu/gorm"
"github.com/pkg/errors"
uuid
"github.com/satori/go.uuid"
"main/controller/servers"
"main/init/qmsql"
"main/model/modelInterface"
"main/tools"
)
type
SysUser
struct
{
...
...
@@ -62,8 +62,8 @@ func (u *SysUser) Login() (err error, userInter *SysUser) {
var
user
SysUser
u
.
Password
=
tools
.
MD5V
(
u
.
Password
)
err
=
qmsql
.
DEFAULTDB
.
Where
(
"username = ? AND password = ?"
,
u
.
Username
,
u
.
Password
)
.
First
(
&
user
)
.
Error
if
(
err
!=
nil
)
{
return
err
,
&
user
if
err
!=
nil
{
return
err
,
&
user
}
err
=
qmsql
.
DEFAULTDB
.
Where
(
"authority_id = ?"
,
user
.
AuthorityId
)
.
First
(
&
user
.
Authority
)
.
Error
return
err
,
&
user
...
...
QMPlusServer/model/sysModel/sys_worfFlow.go
浏览文件 @
e1958efb
package
sysModel
import
(
"gin-vue-admin/init/qmsql"
"github.com/jinzhu/gorm"
"main/init/qmsql"
)
//工作流属性表
...
...
@@ -11,13 +11,13 @@ type SysWorkflow struct {
WorkflowNickName
string
`json:"workflowNickName"`
// 工作流名称
WorkflowName
string
`json:"workflowName"`
// 工作流英文id
WorkflowDescription
string
`json:"workflowDescription"`
// 工作流描述
WorkflowStepInfo
[]
SysWorkflowStepInfo
`json:"workflowStep"`
// 工作流步骤
WorkflowStepInfo
[]
SysWorkflowStepInfo
`json:"workflowStep"`
// 工作流步骤
}
// 工作流状态表
type
SysWorkflowStepInfo
struct
{
gorm
.
Model
SysWorkflowID
uint
`json:"workflowID"`
// 所属工作流ID
SysWorkflowID
uint
`json:"workflowID"`
// 所属工作流ID
IsStrat
bool
`json:"isStrat"`
// 是否是开始流节点
StepName
string
`json:"stepName"`
// 工作流名称
StepNo
float64
`json:"stepNo"`
// 步骤id (第几步)
...
...
QMPlusServer/router/exp_fileUploadAndDownload.go
浏览文件 @
e1958efb
package
router
import
(
"gin-vue-admin/controller/api"
"gin-vue-admin/middleware"
"github.com/gin-gonic/gin"
"main/controller/api"
"main/middleware"
)
func
InitFileUploadAndDownloadRouter
(
Router
*
gin
.
RouterGroup
)
{
...
...
QMPlusServer/router/sys_api.go
浏览文件 @
e1958efb
package
router
import
(
"gin-vue-admin/controller/api"
"gin-vue-admin/middleware"
"github.com/gin-gonic/gin"
"main/controller/api"
"main/middleware"
)
func
InitApiRouter
(
Router
*
gin
.
RouterGroup
)
{
...
...
QMPlusServer/router/sys_authority.go
浏览文件 @
e1958efb
package
router
import
(
"gin-vue-admin/controller/api"
"gin-vue-admin/middleware"
"github.com/gin-gonic/gin"
"main/controller/api"
"main/middleware"
)
func
InitAuthorityRouter
(
Router
*
gin
.
RouterGroup
)
{
...
...
QMPlusServer/router/sys_base.go
浏览文件 @
e1958efb
package
router
import
(
"gin-vue-admin/controller/api"
"github.com/gin-gonic/gin"
"main/controller/api"
)
func
InitBaseRouter
(
Router
*
gin
.
RouterGroup
)
(
R
gin
.
IRoutes
)
{
...
...
QMPlusServer/router/sys_casbin.go
浏览文件 @
e1958efb
package
router
import
(
"gin-vue-admin/controller/api"
"gin-vue-admin/middleware"
"github.com/gin-gonic/gin"
"main/controller/api"
"main/middleware"
)
func
InitCasbinRouter
(
Router
*
gin
.
RouterGroup
)
{
...
...
QMPlusServer/router/sys_menu.go
浏览文件 @
e1958efb
package
router
import
(
"gin-vue-admin/controller/api"
"gin-vue-admin/middleware"
"github.com/gin-gonic/gin"
"main/controller/api"
"main/middleware"
)
func
InitMenuRouter
(
Router
*
gin
.
RouterGroup
)
(
R
gin
.
IRoutes
)
{
...
...
QMPlusServer/router/sys_user.go
浏览文件 @
e1958efb
package
router
import
(
"gin-vue-admin/controller/api"
"gin-vue-admin/middleware"
"github.com/gin-gonic/gin"
"main/controller/api"
"main/middleware"
)
func
InitUserRouter
(
Router
*
gin
.
RouterGroup
)
{
...
...
QMPlusServer/router/sys_workflow.go
浏览文件 @
e1958efb
package
router
import
(
"gin-vue-admin/controller/api"
"gin-vue-admin/middleware"
"github.com/gin-gonic/gin"
"main/controller/api"
"main/middleware"
)
func
InitWorkflowRouter
(
Router
*
gin
.
RouterGroup
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录