Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FLIPPED-AURORA
gin-vue-admin
提交
581ecb93
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,发现更多精彩内容 >>
提交
581ecb93
编写于
12月 30, 2019
作者:
G
Granty1
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of github.com:granty1/gin-vue-admin
上级
a20af0ae
9fc25e9a
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
175 addition
and
58 deletion
+175
-58
QMPlusServer/controller/api/sys_jwt_blacklist.go
QMPlusServer/controller/api/sys_jwt_blacklist.go
+28
-0
QMPlusServer/db/qmplus.sql
QMPlusServer/db/qmplus.sql
+61
-48
QMPlusServer/init/initRouter/init_router.go
QMPlusServer/init/initRouter/init_router.go
+2
-1
QMPlusServer/init/registTable/regist_table.go
QMPlusServer/init/registTable/regist_table.go
+1
-0
QMPlusServer/middleware/jwt.go
QMPlusServer/middleware/jwt.go
+12
-0
QMPlusServer/model/sysModel/sys_jwt_blacklist.go
QMPlusServer/model/sysModel/sys_jwt_blacklist.go
+23
-0
QMPlusServer/model/sysModel/sys_user.go
QMPlusServer/model/sysModel/sys_user.go
+3
-3
QMPlusServer/router/sys_jwt.go
QMPlusServer/router/sys_jwt.go
+14
-0
QMPlusVuePage/src/api/jwt.js
QMPlusVuePage/src/api/jwt.js
+16
-0
QMPlusVuePage/src/store/module/user.js
QMPlusVuePage/src/store/module/user.js
+7
-0
QMPlusVuePage/src/utils/request.js
QMPlusVuePage/src/utils/request.js
+6
-4
QMPlusVuePage/src/view/layout/index.vue
QMPlusVuePage/src/view/layout/index.vue
+2
-2
未找到文件。
QMPlusServer/controller/api/sys_jwt_blacklist.go
0 → 100644
浏览文件 @
581ecb93
package
api
import
(
"fmt"
"gin-vue-admin/controller/servers"
"gin-vue-admin/model/sysModel"
"github.com/gin-gonic/gin"
)
// @Tags jwt
// @Summary jwt加入黑名单
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Success 200 {string} string "{"success":true,"data":{},"msg":"拉黑成功"}"
// @Router /jwt/jsonInBlacklist [post]
func
JsonInBlacklist
(
c
*
gin
.
Context
){
token
:=
c
.
Request
.
Header
.
Get
(
"x-token"
)
ModelJwt
:=
sysModel
.
JwtBlacklist
{
Jwt
:
token
,
}
err
:=
ModelJwt
.
JsonInBlacklist
()
if
err
!=
nil
{
servers
.
ReportFormat
(
c
,
false
,
fmt
.
Sprintf
(
"jwt作废失败,%v"
,
err
),
gin
.
H
{})
}
else
{
servers
.
ReportFormat
(
c
,
true
,
"jwt作废成功"
,
gin
.
H
{})
}
}
QMPlusServer/db/qmplus.sql
浏览文件 @
581ecb93
/*
Navicat Premium Data Transfer
Source Server :
qmplus
Source Server :
zhongrongze
Source Server Type : MySQL
Source Server Version : 50644
Source Host : localhost:3306
...
...
@@ -11,7 +11,7 @@
Target Server Version : 50644
File Encoding : 65001
Date: 2
6/12/2019 13:22:40
Date: 2
8/12/2019 18:34:34
*/
SET
NAMES
utf8mb4
;
...
...
@@ -34,36 +34,6 @@ CREATE TABLE `casbin_rule` (
-- ----------------------------
-- Records of casbin_rule
-- ----------------------------
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/base/login'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/base/regist'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/api/createApi'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/api/getApiList'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/api/getApiById'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/api/deleteApi'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/api/updataApi'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/api/getAllApis'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/authority/createAuthority'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/authority/deleteAuthority'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/authority/getAuthorityList'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/menu/getMenu'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/menu/getMenuList'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/menu/addBaseMenu'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/menu/getBaseMenuTree'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/menu/addMenuAuthority'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/menu/getMenuAuthority'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/menu/deleteBaseMenu'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/menu/updataBaseMenu'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/menu/getBaseMenuById'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/user/changePassword'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/user/uploadHeaderImg'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/user/getInfoList'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/user/getUserList'
,
'POST'
,
''
,
''
,
''
);
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/casbinPUpdata'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/casbin/getPolicyPathByAuthorityId'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'9528'
,
'/base/login'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'9528'
,
'/base/regist'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'9528'
,
'/api/createApi'
,
'POST'
,
''
,
''
,
''
);
...
...
@@ -94,6 +64,38 @@ INSERT INTO `casbin_rule` VALUES ('p', '9528', '/fileUploadAndDownload/getFileLi
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'9528'
,
'/fileUploadAndDownload/deleteFile'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'9528'
,
'/casbin/casbinPUpdata'
,
'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'
,
'888'
,
'/base/login'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/base/regist'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/api/createApi'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/api/getApiList'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/api/getApiById'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/api/deleteApi'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/api/updataApi'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/api/getAllApis'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/authority/createAuthority'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/authority/deleteAuthority'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/authority/getAuthorityList'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/menu/getMenu'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/menu/getMenuList'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/menu/addBaseMenu'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/menu/getBaseMenuTree'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/menu/addMenuAuthority'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/menu/getMenuAuthority'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/menu/deleteBaseMenu'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/menu/updataBaseMenu'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/menu/getBaseMenuById'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/user/changePassword'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/user/uploadHeaderImg'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/user/getInfoList'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/user/getUserList'
,
'POST'
,
''
,
''
,
''
);
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/casbinPUpdata'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/casbin/getPolicyPathByAuthorityId'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
`casbin_rule`
VALUES
(
'p'
,
'888'
,
'/jwt/jsonInBlacklist'
,
'POST'
,
''
,
''
,
''
);
-- ----------------------------
-- Table structure for ch_cities
...
...
@@ -3730,7 +3732,7 @@ CREATE TABLE `exa_file_upload_and_downloads` (
PRIMARY
KEY
(
`id`
)
USING
BTREE
,
INDEX
`idx_file_upload_and_downloads_deleted_at`
(
`deleted_at`
)
USING
BTREE
,
INDEX
`idx_exa_file_upload_and_downloads_deleted_at`
(
`deleted_at`
)
USING
BTREE
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
19
CHARACTER
SET
=
utf8
COLLATE
=
utf8_general_ci
ROW_FORMAT
=
Compact
;
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
26
CHARACTER
SET
=
utf8
COLLATE
=
utf8_general_ci
ROW_FORMAT
=
Compact
;
-- ----------------------------
-- Records of exa_file_upload_and_downloads
...
...
@@ -3740,9 +3742,27 @@ INSERT INTO `exa_file_upload_and_downloads` VALUES (10, '2019-10-26 23:10:44', '
INSERT
INTO
`exa_file_upload_and_downloads`
VALUES
(
12
,
'2019-10-26 23:14:08'
,
'2019-10-26 23:14:08'
,
NULL
,
'logo.png'
,
'http://qmplusimg.henrongyi.top/1572102846logo.png'
,
'png'
,
'1572102846logo.png'
);
INSERT
INTO
`exa_file_upload_and_downloads`
VALUES
(
13
,
'2019-10-26 23:18:17'
,
'2019-10-26 23:18:17'
,
NULL
,
'logo.png'
,
'http://qmplusimg.henrongyi.top/1572103096logo.png'
,
'png'
,
'1572103096logo.png'
);
INSERT
INTO
`exa_file_upload_and_downloads`
VALUES
(
15
,
'2019-12-15 14:31:00'
,
'2019-12-15 14:31:00'
,
NULL
,
'logo.png'
,
'http://qmplusimg.henrongyi.top/1576391451logo.png'
,
'png'
,
'1576391451logo.png'
);
INSERT
INTO
`exa_file_upload_and_downloads`
VALUES
(
16
,
'2019-12-15 14:45:57'
,
'2019-12-15 14:45:57'
,
NULL
,
'cjkz.png'
,
'http://qmplusimg.henrongyi.top/1576392350cjkz.png'
,
'png'
,
'1576392350cjkz.png'
);
INSERT
INTO
`exa_file_upload_and_downloads`
VALUES
(
17
,
'2019-12-15 14:46:56'
,
'2019-12-15 14:46:56'
,
NULL
,
'cjkz.png'
,
'http://qmplusimg.henrongyi.top/1576392408cjkz.png'
,
'png'
,
'1576392408cjkz.png'
);
INSERT
INTO
`exa_file_upload_and_downloads`
VALUES
(
18
,
'2019-12-15 14:52:40'
,
'2019-12-15 14:52:40'
,
NULL
,
'BasicsBg.png'
,
'http://qmplusimg.henrongyi.top/1576392751BasicsBg.png'
,
'png'
,
'1576392751BasicsBg.png'
);
-- ----------------------------
-- Table structure for jwt_blacklists
-- ----------------------------
DROP
TABLE
IF
EXISTS
`jwt_blacklists`
;
CREATE
TABLE
`jwt_blacklists`
(
`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
,
`jwt`
text
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
NULL
,
PRIMARY
KEY
(
`id`
)
USING
BTREE
,
INDEX
`idx_jwt_blacklists_deleted_at`
(
`deleted_at`
)
USING
BTREE
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
6
CHARACTER
SET
=
utf8
COLLATE
=
utf8_general_ci
ROW_FORMAT
=
Compact
;
-- ----------------------------
-- Records of jwt_blacklists
-- ----------------------------
INSERT
INTO
`jwt_blacklists`
VALUES
(
3
,
'2019-12-28 18:29:05'
,
'2019-12-28 18:29:05'
,
NULL
,
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4MTMzNzM2LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1Nzc1Mjc5MzZ9.T7ikGw-lgAAQlfMne7zPIF-PlfQMg37uBCYJ24Y_B38'
);
INSERT
INTO
`jwt_blacklists`
VALUES
(
4
,
'2019-12-28 18:31:02'
,
'2019-12-28 18:31:02'
,
NULL
,
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4MTMzODUzLCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1Nzc1MjgwNTN9.tDzUm4KNFeJCErNfZGfuF2tcuolga2f_2dE0nTl_UZU'
);
INSERT
INTO
`jwt_blacklists`
VALUES
(
5
,
'2019-12-28 18:31:25'
,
'2019-12-28 18:31:25'
,
NULL
,
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4MTMzODcwLCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1Nzc1MjgwNzB9.mspXy9sqQO_5PusPReLalodo_ybWRKxb3Ownf2r2HxE'
);
-- ----------------------------
-- Table structure for sys_apis
...
...
@@ -3760,7 +3780,7 @@ CREATE TABLE `sys_apis` (
PRIMARY
KEY
(
`id`
)
USING
BTREE
,
INDEX
`idx_apis_deleted_at`
(
`deleted_at`
)
USING
BTREE
,
INDEX
`idx_sys_apis_deleted_at`
(
`deleted_at`
)
USING
BTREE
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
3
5
CHARACTER
SET
=
utf8
COLLATE
=
utf8_general_ci
ROW_FORMAT
=
Compact
;
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
3
6
CHARACTER
SET
=
utf8
COLLATE
=
utf8_general_ci
ROW_FORMAT
=
Compact
;
-- ----------------------------
-- Records of sys_apis
...
...
@@ -3795,6 +3815,7 @@ INSERT INTO `sys_apis` VALUES (31, '2019-10-26 20:14:59', '2019-10-26 20:14:59',
INSERT
INTO
`sys_apis`
VALUES
(
32
,
'2019-12-12 13:28:47'
,
'2019-12-12 13:28:47'
,
NULL
,
NULL
,
'/casbin/casbinPUpdata'
,
'更改角色api权限'
,
'casbin'
);
INSERT
INTO
`sys_apis`
VALUES
(
33
,
'2019-12-12 13:28:59'
,
'2019-12-12 13:28:59'
,
NULL
,
NULL
,
'/casbin/getPolicyPathByAuthorityId'
,
'获取权限列表'
,
'casbin'
);
INSERT
INTO
`sys_apis`
VALUES
(
34
,
'2019-12-12 17:02:15'
,
'2019-12-12 17:02:15'
,
NULL
,
NULL
,
'/fileUploadAndDownload/deleteFile'
,
'删除文件'
,
'fileUploadAndDownload'
);
INSERT
INTO
`sys_apis`
VALUES
(
35
,
'2019-12-28 18:18:07'
,
'2019-12-28 18:18:07'
,
NULL
,
NULL
,
'/jwt/jsonInBlacklist'
,
'jwt加入黑名单'
,
'jwt'
);
-- ----------------------------
-- Table structure for sys_authorities
...
...
@@ -3812,13 +3833,14 @@ CREATE TABLE `sys_authorities` (
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
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
8
CHARACTER
SET
=
utf8
COLLATE
=
utf8_general_ci
ROW_FORMAT
=
Compact
;
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
9
CHARACTER
SET
=
utf8
COLLATE
=
utf8_general_ci
ROW_FORMAT
=
Compact
;
-- ----------------------------
-- 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'
);
-- ----------------------------
-- Table structure for sys_base_menus
...
...
@@ -3952,16 +3974,7 @@ CREATE TABLE `sys_users` (
-- Records of sys_users
-- ----------------------------
INSERT
INTO
`sys_users`
VALUES
(
10
,
'2019-09-13 17:23:46'
,
'2019-10-21 11:16:03'
,
NULL
,
0
x63653064363638352D633135662D343132362D613562342D383930626339643233353664
,
NULL
,
NULL
,
'超级管理员'
,
'http://qmplusimg.henrongyi.top/1571627762timg.jpg'
,
888
,
NULL
,
'admin'
,
'e10adc3949ba59abbe56e057f20f883e'
,
NULL
,
NULL
);
INSERT
INTO
`sys_users`
VALUES
(
11
,
'2019-09-13 17:27:29'
,
'2019-09-13 17:27:29'
,
NULL
,
0
x66643665663739622D393434632D343838382D383337372D616265326432363038383538
,
NULL
,
NULL
,
'QMPlusUser'
,
'http://qmplusimg.henrongyi.top/1572075907logo.png'
,
888
,
NULL
,
'a303176530'
,
'3ec063004a6f31642261936a379fde3d'
,
NULL
,
NULL
);
INSERT
INTO
`sys_users`
VALUES
(
12
,
'2019-09-13 17:28:56'
,
'2019-09-13 17:28:56'
,
NULL
,
0
x65373939636563362D346337662D343338632D383634372D376435633333393734353165
,
NULL
,
NULL
,
'QMPlusUser'
,
'http://qmplusimg.henrongyi.top/1572075907logo.png'
,
888
,
NULL
,
'a30317465'
,
'3ec063004a6f31642261936a379fde3d'
,
NULL
,
NULL
);
INSERT
INTO
`sys_users`
VALUES
(
13
,
'2019-09-13 17:29:26'
,
'2019-09-13 17:29:26'
,
NULL
,
0
x65653764353932322D323333312D343162632D393363322D613665366461306465343230
,
NULL
,
NULL
,
'QMPlusUser'
,
'http://qmplusimg.henrongyi.top/1572075907logo.png'
,
888
,
NULL
,
'a30317465'
,
'3ec063004a6f31642261936a379fde3d'
,
NULL
,
NULL
);
INSERT
INTO
`sys_users`
VALUES
(
14
,
'2019-09-13 17:29:28'
,
'2019-12-13 11:32:33'
,
NULL
,
0
x35623464333461322D343266352D343763352D613932642D613637616536643461643334
,
NULL
,
NULL
,
'QMPlusUser'
,
'http://qmplusimg.henrongyi.top/1572075907logo.png'
,
888
,
NULL
,
'a30317465'
,
'3ec063004a6f31642261936a379fde3d'
,
NULL
,
NULL
);
INSERT
INTO
`sys_users`
VALUES
(
15
,
'2019-09-13 17:31:16'
,
'2019-12-13 11:32:34'
,
NULL
,
0
x34306437393436612D363732382D346536662D396434302D313432356566653831363032
,
NULL
,
NULL
,
'QMPlusUser'
,
'http://qmplusimg.henrongyi.top/1572075907logo.png'
,
888
,
NULL
,
'a303146523'
,
'e10adc3949ba59abbe56e057f20f883e'
,
NULL
,
NULL
);
INSERT
INTO
`sys_users`
VALUES
(
16
,
'2019-12-15 14:52:43'
,
'2019-12-15 14:52:43'
,
NULL
,
0
x36633836363430392D343533612D343138342D613365322D343432373832323262323531
,
NULL
,
NULL
,
'QMPlusUser'
,
'http://www.henrongyi.top/avatar/lufu.jpg'
,
888
,
NULL
,
'test123'
,
'733d7be2196ff70efaf6913fc8bdcabf'
,
NULL
,
NULL
);
INSERT
INTO
`sys_users`
VALUES
(
17
,
'2019-12-15 14:56:10'
,
'2019-12-15 14:56:10'
,
NULL
,
0
x62396464313431382D643032372D346138652D623032382D313534336663313363316465
,
NULL
,
NULL
,
'测试测试'
,
'http://qmplusimg.henrongyi.top/1576392856logo.png'
,
888
,
NULL
,
'test1232'
,
'd41d8cd98f00b204e9800998ecf8427e'
,
NULL
,
NULL
);
INSERT
INTO
`sys_users`
VALUES
(
18
,
'2019-12-15 14:56:40'
,
'2019-12-15 14:56:40'
,
NULL
,
0
x35653134386637642D646366342D343830362D383164392D316531363666356262373030
,
NULL
,
NULL
,
'测试一号'
,
'http://qmplusimg.henrongyi.top/1576392993avatar.png'
,
888
,
NULL
,
'test1236544'
,
'd41d8cd98f00b204e9800998ecf8427e'
,
NULL
,
NULL
);
INSERT
INTO
`sys_users`
VALUES
(
19
,
'2019-12-15 14:57:41'
,
'2019-12-15 14:57:41'
,
NULL
,
0
x31363037636364322D326436342D343638642D616464352D653762363933646131353838
,
NULL
,
NULL
,
'测试用户100号'
,
'http://qmplusimg.henrongyi.top/1576393049deleteImg.png'
,
888
,
NULL
,
'test11111'
,
'd41d8cd98f00b204e9800998ecf8427e'
,
NULL
,
NULL
);
INSERT
INTO
`sys_users`
VALUES
(
20
,
'2019-12-15 14:59:00'
,
'2019-12-15 14:59:00'
,
NULL
,
0
x31316236393437662D393361342D343066312D613061632D353838323634353337326635
,
NULL
,
NULL
,
'再注册一个就结束'
,
'http://qmplusimg.henrongyi.top/1576393127soucang.png'
,
9528
,
NULL
,
'admin111'
,
'e10adc3949ba59abbe56e057f20f883e'
,
NULL
,
NULL
);
INSERT
INTO
`sys_users`
VALUES
(
11
,
'2019-09-13 17:27:29'
,
'2019-09-13 17:27:29'
,
NULL
,
0
x66643665663739622D393434632D343838382D383337372D616265326432363038383538
,
NULL
,
NULL
,
'QMPlusUser'
,
'http://qmplusimg.henrongyi.top/1572075907logo.png'
,
9528
,
NULL
,
'a303176530'
,
'3ec063004a6f31642261936a379fde3d'
,
NULL
,
NULL
);
-- ----------------------------
-- Table structure for sys_workflow_step_infos
...
...
QMPlusServer/init/initRouter/init_router.go
浏览文件 @
581ecb93
...
...
@@ -24,6 +24,7 @@ func InitRouter() *gin.Engine {
router
.
InitApiRouter
(
ApiGroup
)
// 注册功能api路由
router
.
InitFileUploadAndDownloadRouter
(
ApiGroup
)
// 文件上传下载功能路由
router
.
InitWorkflowRouter
(
ApiGroup
)
// 工作流相关路由
router
.
InitCasbinRouter
(
ApiGroup
)
router
.
InitCasbinRouter
(
ApiGroup
)
// 权限相关路由
router
.
InitJwtRouter
(
ApiGroup
)
// jwt相关路由
return
Router
}
QMPlusServer/init/registTable/regist_table.go
浏览文件 @
581ecb93
...
...
@@ -13,6 +13,7 @@ func RegistTable(db *gorm.DB) {
sysModel
.
SysMenu
{},
sysModel
.
SysApi
{},
sysModel
.
SysBaseMenu
{},
sysModel
.
JwtBlacklist
{},
dbModel
.
ExaFileUploadAndDownload
{},
sysModel
.
SysWorkflow
{},
sysModel
.
SysWorkflowStepInfo
{},
...
...
QMPlusServer/middleware/jwt.go
浏览文件 @
581ecb93
...
...
@@ -3,6 +3,7 @@ package middleware
import
(
"errors"
"gin-vue-admin/controller/servers"
"gin-vue-admin/model/sysModel"
"github.com/dgrijalva/jwt-go"
"github.com/gin-gonic/gin"
uuid
"github.com/satori/go.uuid"
...
...
@@ -13,6 +14,9 @@ func JWTAuth() gin.HandlerFunc {
return
func
(
c
*
gin
.
Context
)
{
// 我们这里jwt鉴权取头部信息 x-token 登录时回返回token信息 这里前端需要把token存储到cookie或者本地localSstorage中 不过需要跟后端协商过期时间 可以约定刷新令牌或者重新登录
token
:=
c
.
Request
.
Header
.
Get
(
"x-token"
)
ModelToken
:=
sysModel
.
JwtBlacklist
{
Jwt
:
token
,
}
if
token
==
""
{
servers
.
ReportFormat
(
c
,
false
,
"未登录或非法访问"
,
gin
.
H
{
"reload"
:
true
,
...
...
@@ -20,6 +24,13 @@ func JWTAuth() gin.HandlerFunc {
c
.
Abort
()
return
}
if
ModelToken
.
IsBlacklist
(
token
){
servers
.
ReportFormat
(
c
,
false
,
"授权已失效"
,
gin
.
H
{
"reload"
:
true
,
})
c
.
Abort
()
return
}
j
:=
NewJWT
()
// parseToken 解析token包含的信息
claims
,
err
:=
j
.
ParseToken
(
token
)
...
...
@@ -135,3 +146,4 @@ func (j *JWT) RefreshToken(tokenString string) (string, error) {
}
return
""
,
TokenInvalid
}
QMPlusServer/model/sysModel/sys_jwt_blacklist.go
0 → 100644
浏览文件 @
581ecb93
package
sysModel
import
(
"gin-vue-admin/init/qmsql"
"github.com/jinzhu/gorm"
)
type
JwtBlacklist
struct
{
gorm
.
Model
Jwt
string
`gorm:"type:text"`
}
func
(
j
*
JwtBlacklist
)
JsonInBlacklist
()(
err
error
){
err
=
qmsql
.
DEFAULTDB
.
Create
(
j
)
.
Error
return
}
//判断JWT是否在黑名单内部
func
(
j
*
JwtBlacklist
)
IsBlacklist
(
Jwt
string
)(
bool
){
isNotFound
:=
qmsql
.
DEFAULTDB
.
Where
(
"jwt = ?"
,
Jwt
)
.
First
(
j
)
.
RecordNotFound
()
return
!
isNotFound
}
\ No newline at end of file
QMPlusServer/model/sysModel/sys_user.go
浏览文件 @
581ecb93
...
...
@@ -29,9 +29,9 @@ type SysUser struct {
func
(
u
*
SysUser
)
Regist
()
(
err
error
,
userInter
*
SysUser
)
{
var
user
SysUser
//判断用户名是否注册
findErr
:=
qmsql
.
DEFAULTDB
.
Where
(
"username = ?"
,
u
.
Username
)
.
First
(
&
user
)
.
Error
//
err为nil
表明读取到了 不能注册
if
findErr
==
nil
{
notResigt
:=
qmsql
.
DEFAULTDB
.
Where
(
"username = ?"
,
u
.
Username
)
.
First
(
&
user
)
.
RecordNotFound
()
//
notResigt为false
表明读取到了 不能注册
if
!
notResigt
{
return
errors
.
New
(
"用户名已注册"
),
nil
}
else
{
// 否则 附加uuid 密码md5简单加密 注册
...
...
QMPlusServer/router/sys_jwt.go
0 → 100644
浏览文件 @
581ecb93
package
router
import
(
"gin-vue-admin/controller/api"
"gin-vue-admin/middleware"
"github.com/gin-gonic/gin"
)
func
InitJwtRouter
(
Router
*
gin
.
RouterGroup
)
{
ApiRouter
:=
Router
.
Group
(
"jwt"
)
.
Use
(
middleware
.
JWTAuth
())
.
Use
(
middleware
.
CasbinHandler
())
{
ApiRouter
.
POST
(
"jsonInBlacklist"
,
api
.
JsonInBlacklist
)
//jwt加入黑名单
}
}
\ No newline at end of file
QMPlusVuePage/src/api/jwt.js
0 → 100644
浏览文件 @
581ecb93
import
service
from
'
@/utils/request
'
// @Tags jwt
// @Summary jwt加入黑名单
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Success 200 {string} string "{"success":true,"data":{},"msg":"拉黑成功"}"
// @Router /jwt/jsonInBlacklist [post]
export
const
jsonInBlacklist
=
()
=>
{
return
service
({
url
:
"
/jwt/jsonInBlacklist
"
,
method
:
'
post
'
,
})
}
\ No newline at end of file
QMPlusVuePage/src/store/module/user.js
浏览文件 @
581ecb93
import
{
login
}
from
'
@/api/user
'
import
{
jsonInBlacklist
}
from
'
@/api/jwt
'
import
router
from
'
@/router/index
'
export
const
user
=
{
namespaced
:
true
,
...
...
@@ -52,6 +53,12 @@ export const user = {
router
.
push
({
path
:
'
/layout/dashbord
'
})
}
}
},
async
LoginOut
({
commit
})
{
const
res
=
await
jsonInBlacklist
()
if
(
res
.
success
)
{
commit
(
"
LoginOut
"
)
}
}
},
getters
:
{
...
...
QMPlusVuePage/src/utils/request.js
浏览文件 @
581ecb93
...
...
@@ -61,11 +61,13 @@ service.interceptors.response.use(
Message
({
showClose
:
true
,
message
:
response
.
data
.
msg
,
type
:
'
error
'
type
:
'
error
'
,
onClose
:
()
=>
{
if
(
response
.
data
.
data
&&
response
.
data
.
data
.
reload
)
{
store
.
commit
(
'
user/LoginOut
'
)
}
}
})
if
(
response
.
data
.
data
&&
response
.
data
.
data
.
reload
)
{
store
.
commit
(
'
user/LoginOut
'
)
}
return
Promise
.
reject
(
response
.
data
.
msg
)
}
},
...
...
QMPlusVuePage/src/view/layout/index.vue
浏览文件 @
581ecb93
...
...
@@ -51,7 +51,7 @@
<
script
>
import
Aside
from
'
@/view/layout/aside
'
import
{
mapGetters
,
map
Muta
tions
}
from
'
vuex
'
import
{
mapGetters
,
map
Ac
tions
}
from
'
vuex
'
export
default
{
name
:
'
Layout
'
,
data
()
{
...
...
@@ -63,7 +63,7 @@ export default {
Aside
},
methods
:
{
...
map
Muta
tions
(
'
user
'
,
[
'
LoginOut
'
]),
...
map
Ac
tions
(
'
user
'
,
[
'
LoginOut
'
]),
totalCollapse
()
{
this
.
isCollapse
=
!
this
.
isCollapse
this
.
$bus
.
emit
(
'
totalCollapse
'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录