Skip to content

Commit

Permalink
Merge pull request #113 from LyricTian/develop
Browse files Browse the repository at this point in the history
Fix postgres tinyint
  • Loading branch information
LyricTian authored Aug 16, 2021
2 parents a904050 + 7798f02 commit 9734b67
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions internal/app/dao/menu/menu.entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ type Menu struct {
Router *string `gorm:"size:255;"` // 访问路由
ParentID *uint64 `gorm:"index;default:0;"` // 父级内码
ParentPath *string `gorm:"size:512;index;default:'';"` // 父级路径
IsShow int `gorm:"type:tinyint;index;default:0;"` // 是否显示(1:显示 2:隐藏)
Status int `gorm:"type:tinyint;index;default:0;"` // 状态(1:启用 2:禁用)
IsShow int `gorm:"index;default:0;"` // 是否显示(1:显示 2:隐藏)
Status int `gorm:"index;default:0;"` // 状态(1:启用 2:禁用)
Sequence int `gorm:"index;default:0;"` // 排序值
Memo *string `gorm:"size:1024;"` // 备注
Creator uint64 `gorm:""` // 创建人
Expand Down
2 changes: 1 addition & 1 deletion internal/app/dao/role/role.entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type Role struct {
Name string `gorm:"size:100;index;default:'';not null;"` // 角色名称
Sequence int `gorm:"index;default:0;"` // 排序值
Memo *string `gorm:"size:1024;"` // 备注
Status int `gorm:"type:tinyint;index;default:0;"` // 状态(1:启用 2:禁用)
Status int `gorm:"index;default:0;"` // 状态(1:启用 2:禁用)
Creator uint64 `gorm:""` // 创建者
}

Expand Down
2 changes: 1 addition & 1 deletion internal/app/dao/user/user.entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type User struct {
Password string `gorm:"size:40;default:'';"` // 密码(sha1(md5(明文)))
Email *string `gorm:"size:255;"` // 邮箱
Phone *string `gorm:"size:20;"` // 手机号
Status int `gorm:"type:tinyint;index;default:0;"` // 状态(1:启用 2:停用)
Status int `gorm:"index;default:0;"` // 状态(1:启用 2:停用)
Creator uint64 `gorm:""` // 创建者
}

Expand Down
3 changes: 2 additions & 1 deletion internal/app/middleware/auth.mw.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import (
"strconv"
"strings"

"github.com/gin-gonic/gin"

"github.com/LyricTian/gin-admin/v8/internal/app/config"
"github.com/LyricTian/gin-admin/v8/internal/app/contextx"
"github.com/LyricTian/gin-admin/v8/internal/app/ginx"
"github.com/LyricTian/gin-admin/v8/pkg/auth"
"github.com/LyricTian/gin-admin/v8/pkg/errors"
"github.com/LyricTian/gin-admin/v8/pkg/logger"
"github.com/gin-gonic/gin"
)

func wrapUserAuthContext(c *gin.Context, userID uint64, userName string) {
Expand Down
4 changes: 1 addition & 3 deletions pkg/auth/jwtauth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ func (a *JWTAuth) GenerateToken(ctx context.Context, userID string) (auth.TokenI
// 解析令牌
func (a *JWTAuth) parseToken(tokenString string) (*jwt.StandardClaims, error) {
token, err := jwt.ParseWithClaims(tokenString, &jwt.StandardClaims{}, a.opts.keyfunc)
if err != nil {
return nil, err
} else if !token.Valid {
if err != nil || !token.Valid {
return nil, auth.ErrInvalidToken
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var (

// 定义错误
var (
ErrInvalidToken = NewResponse(10000, 401, "令牌失效")
ErrInvalidToken = NewResponse(40001, 401, "令牌失效")
ErrNoPerm = NewResponse(0, 401, "无访问权限")
ErrNotFound = NewResponse(0, 404, "资源不存在")
ErrMethodNotAllow = NewResponse(0, 405, "方法不被允许")
Expand Down

0 comments on commit 9734b67

Please sign in to comment.