优化表结构,重构模型,重新实现基于白银网关的提取节点流程
This commit is contained in:
39
web/models/logs_login.go
Normal file
39
web/models/logs_login.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"platform/web/globals/orm"
|
||||
"time"
|
||||
)
|
||||
|
||||
// LogsLogin 登录日志表
|
||||
type LogsLogin struct {
|
||||
ID int32 `json:"id" gorm:"column:id"` // 登录日志ID
|
||||
IP orm.Inet `json:"ip" gorm:"column:ip;not null"` // IP地址
|
||||
UA string `json:"ua" gorm:"column:ua"` // 用户代理
|
||||
GrantType GrantType `json:"grant_type" gorm:"column:grant_type"` // 授权类型
|
||||
PasswordType PasswordType `json:"password_type" gorm:"column:password_type"` // 密码模式子授权类型
|
||||
Success bool `json:"success" gorm:"column:success"` // 登录是否成功
|
||||
UserID *int32 `json:"user_id" gorm:"column:user_id"` // 用户ID
|
||||
Time time.Time `json:"time" gorm:"column:time"` // 登录时间
|
||||
|
||||
User *User `json:"user" gorm:"foreignKey:UserID"`
|
||||
}
|
||||
|
||||
// GrantType 授权类型枚举
|
||||
type GrantType string
|
||||
|
||||
const (
|
||||
GrantTypeAuthorizationCode GrantType = "authorization_code" // 授权码模式
|
||||
GrantTypeClientCredentials GrantType = "client_credentials" // 客户端凭证模式
|
||||
GrantTypeRefreshToken GrantType = "refresh_token" // 刷新令牌模式
|
||||
GrantTypePassword GrantType = "password" // 密码模式
|
||||
)
|
||||
|
||||
// PasswordType 密码模式子授权类型枚举
|
||||
type PasswordType string
|
||||
|
||||
const (
|
||||
PasswordTypePassword PasswordType = "password" // 账号密码
|
||||
PasswordTypePhoneCode PasswordType = "phone_code" // 手机验证码
|
||||
PasswordTypeEmailCode PasswordType = "email_code" // 邮箱验证码
|
||||
)
|
||||
Reference in New Issue
Block a user