27 lines
1.5 KiB
Go
27 lines
1.5 KiB
Go
package models
|
|
|
|
import (
|
|
"platform/web/core"
|
|
"platform/web/globals/orm"
|
|
"time"
|
|
)
|
|
|
|
// Session 会话表
|
|
type Session struct {
|
|
core.Model
|
|
UserID *int32 `json:"user_id" gorm:"column:user_id"` // 用户ID
|
|
AdminID *int32 `json:"admin_id" gorm:"column:admin_id"` // 管理员ID
|
|
ClientID *int32 `json:"client_id" gorm:"column:client_id"` // 客户端ID
|
|
IP *orm.Inet `json:"ip" gorm:"column:ip"` // IP地址
|
|
UA *string `json:"ua" gorm:"column:ua"` // 用户代理
|
|
AccessToken string `json:"access_token" gorm:"column:access_token"` // 访问令牌
|
|
AccessTokenExpires time.Time `json:"access_token_expires" gorm:"column:access_token_expires"` // 访问令牌过期时间
|
|
RefreshToken *string `json:"refresh_token" gorm:"column:refresh_token"` // 刷新令牌
|
|
RefreshTokenExpires *time.Time `json:"refresh_token_expires" gorm:"column:refresh_token_expires"` // 刷新令牌过期时间
|
|
Scopes *string `json:"scopes" gorm:"column:scopes"` // 权限范围
|
|
|
|
User *User `json:"user" gorm:"foreignKey:UserID"`
|
|
Admin *Admin `json:"admin" gorm:"foreignKey:AdminID"`
|
|
Client *Client `json:"client" gorm:"foreignKey:ClientID;belongsTo:ID"`
|
|
}
|