Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FLIPPED-AURORA
gin-vue-admin
提交
c666879d
G
gin-vue-admin
项目概览
FLIPPED-AURORA
/
gin-vue-admin
大约 1 年 前同步成功
通知
333
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,发现更多精彩内容 >>
未验证
提交
c666879d
编写于
7月 13, 2021
作者:
Mr.奇淼(
提交者:
GitHub
7月 13, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #579 from songzhibin97/gva_gormv2_dev
fix:修改redis包,使用推荐的v8
上级
37ed01a1
fb2199c9
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
11 addition
and
11 deletion
+11
-11
server/global/global.go
server/global/global.go
+1
-1
server/go.mod
server/go.mod
+1
-5
server/initialize/redis.go
server/initialize/redis.go
+4
-2
server/service/jwt_black_list.go
server/service/jwt_black_list.go
+5
-3
未找到文件。
server/global/global.go
浏览文件 @
c666879d
...
@@ -9,7 +9,7 @@ import (
...
@@ -9,7 +9,7 @@ import (
"gin-vue-admin/config"
"gin-vue-admin/config"
"github.com/go-redis/redis"
"github.com/go-redis/redis
/v8
"
"github.com/spf13/viper"
"github.com/spf13/viper"
"gorm.io/gorm"
"gorm.io/gorm"
)
)
...
...
server/go.mod
浏览文件 @
c666879d
...
@@ -20,8 +20,8 @@ require (
...
@@ -20,8 +20,8 @@ require (
github.com/go-openapi/swag v0.19.8 // indirect
github.com/go-openapi/swag v0.19.8 // indirect
github.com/go-playground/validator/v10 v10.3.0 // indirect
github.com/go-playground/validator/v10 v10.3.0 // indirect
github.com/go-redis/redis v6.15.7+incompatible
github.com/go-redis/redis v6.15.7+incompatible
github.com/go-redis/redis/v8 v8.11.0
github.com/go-sql-driver/mysql v1.5.0
github.com/go-sql-driver/mysql v1.5.0
github.com/golang/protobuf v1.4.2 // indirect
github.com/gookit/color v1.3.1
github.com/gookit/color v1.3.1
github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 // indirect
github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 // indirect
github.com/jordan-wright/email v0.0.0-20200824153738-3f5bafa1cd84
github.com/jordan-wright/email v0.0.0-20200824153738-3f5bafa1cd84
...
@@ -31,8 +31,6 @@ require (
...
@@ -31,8 +31,6 @@ require (
github.com/mailru/easyjson v0.7.1 // indirect
github.com/mailru/easyjson v0.7.1 // indirect
github.com/mitchellh/mapstructure v1.2.2 // indirect
github.com/mitchellh/mapstructure v1.2.2 // indirect
github.com/mojocn/base64Captcha v1.3.1
github.com/mojocn/base64Captcha v1.3.1
github.com/onsi/ginkgo v1.7.0 // indirect
github.com/onsi/gomega v1.4.3 // indirect
github.com/pelletier/go-toml v1.6.0 // indirect
github.com/pelletier/go-toml v1.6.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/qiniu/api.v7/v7 v7.4.1
github.com/qiniu/api.v7/v7 v7.4.1
...
@@ -52,10 +50,8 @@ require (
...
@@ -52,10 +50,8 @@ require (
go.uber.org/zap v1.10.0
go.uber.org/zap v1.10.0
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 // indirect
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/tools v0.0.0-20200324003944-a576cf524670 // indirect
google.golang.org/protobuf v1.24.0 // indirect
google.golang.org/protobuf v1.24.0 // indirect
gopkg.in/ini.v1 v1.55.0 // indirect
gopkg.in/ini.v1 v1.55.0 // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
gorm.io/driver/mysql v1.0.1
gorm.io/driver/mysql v1.0.1
gorm.io/gorm v1.20.7
gorm.io/gorm v1.20.7
)
)
server/initialize/redis.go
浏览文件 @
c666879d
package
initialize
package
initialize
import
(
import
(
"context"
"gin-vue-admin/global"
"gin-vue-admin/global"
"github.com/go-redis/redis"
"github.com/go-redis/redis/v8"
"go.uber.org/zap"
"go.uber.org/zap"
)
)
...
@@ -13,7 +15,7 @@ func Redis() {
...
@@ -13,7 +15,7 @@ func Redis() {
Password
:
redisCfg
.
Password
,
// no password set
Password
:
redisCfg
.
Password
,
// no password set
DB
:
redisCfg
.
DB
,
// use default DB
DB
:
redisCfg
.
DB
,
// use default DB
})
})
pong
,
err
:=
client
.
Ping
()
.
Result
()
pong
,
err
:=
client
.
Ping
(
context
.
Background
()
)
.
Result
()
if
err
!=
nil
{
if
err
!=
nil
{
global
.
GVA_LOG
.
Error
(
"redis connect ping failed, err:"
,
zap
.
Any
(
"err"
,
err
))
global
.
GVA_LOG
.
Error
(
"redis connect ping failed, err:"
,
zap
.
Any
(
"err"
,
err
))
}
else
{
}
else
{
...
...
server/service/jwt_black_list.go
浏览文件 @
c666879d
package
service
package
service
import
(
import
(
"context"
"errors"
"errors"
"gin-vue-admin/global"
"gin-vue-admin/global"
"gin-vue-admin/model"
"gin-vue-admin/model"
"gorm.io/gorm"
"time"
"time"
"gorm.io/gorm"
)
)
//@author: [piexlmax](https://github.com/piexlmax)
//@author: [piexlmax](https://github.com/piexlmax)
...
@@ -38,7 +40,7 @@ func IsBlacklist(jwt string) bool {
...
@@ -38,7 +40,7 @@ func IsBlacklist(jwt string) bool {
//@return: err error, redisJWT string
//@return: err error, redisJWT string
func
GetRedisJWT
(
userName
string
)
(
err
error
,
redisJWT
string
)
{
func
GetRedisJWT
(
userName
string
)
(
err
error
,
redisJWT
string
)
{
redisJWT
,
err
=
global
.
GVA_REDIS
.
Get
(
userName
)
.
Result
()
redisJWT
,
err
=
global
.
GVA_REDIS
.
Get
(
context
.
Background
(),
userName
)
.
Result
()
return
err
,
redisJWT
return
err
,
redisJWT
}
}
...
@@ -51,6 +53,6 @@ func GetRedisJWT(userName string) (err error, redisJWT string) {
...
@@ -51,6 +53,6 @@ func GetRedisJWT(userName string) (err error, redisJWT string) {
func
SetRedisJWT
(
jwt
string
,
userName
string
)
(
err
error
)
{
func
SetRedisJWT
(
jwt
string
,
userName
string
)
(
err
error
)
{
// 此处过期时间等于jwt过期时间
// 此处过期时间等于jwt过期时间
timer
:=
time
.
Duration
(
global
.
GVA_CONFIG
.
JWT
.
ExpiresTime
)
*
time
.
Second
timer
:=
time
.
Duration
(
global
.
GVA_CONFIG
.
JWT
.
ExpiresTime
)
*
time
.
Second
err
=
global
.
GVA_REDIS
.
Set
(
userName
,
jwt
,
timer
)
.
Err
()
err
=
global
.
GVA_REDIS
.
Set
(
context
.
Background
(),
userName
,
jwt
,
timer
)
.
Err
()
return
err
return
err
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录