提交 b8eccbd7 编写于 作者: Mr.奇淼('s avatar Mr.奇淼(

Merge remote-tracking branch 'origin/gva_gormv2_dev' into gva_gormv2_dev

...@@ -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"
) )
......
...@@ -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
) )
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 {
......
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
} }
...@@ -3,8 +3,7 @@ FROM node:12.16.1 ...@@ -3,8 +3,7 @@ FROM node:12.16.1
WORKDIR /gva_web/ WORKDIR /gva_web/
COPY . . COPY . .
RUN npm install -g cnpm --registry=https://registry.npm.taobao.org RUN npm install
RUN cnpm install || npm install
RUN npm run build RUN npm run build
FROM nginx:alpine FROM nginx:alpine
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册