45 lines
1.5 KiB
Go
45 lines
1.5 KiB
Go
package models
|
||
|
||
import (
|
||
"platform/web/core"
|
||
)
|
||
|
||
// Client 客户端表
|
||
type Client struct {
|
||
core.Model
|
||
ClientID string `json:"client_id" gorm:"column:client_id"` // OAuth2客户端标识符
|
||
ClientSecret string `json:"client_secret" gorm:"column:client_secret"` // OAuth2客户端密钥
|
||
RedirectURI *string `json:"redirect_uri,omitempty" gorm:"column:redirect_uri"` // OAuth2 重定向URI
|
||
Spec ClientSpec `json:"spec" gorm:"column:spec"` // 安全规范:1-native,2-browser,3-web,4-api
|
||
Name string `json:"name" gorm:"column:name"` // 名称
|
||
Icon *string `json:"icon,omitempty" gorm:"column:icon"` // 图标URL
|
||
Status ClientStatus `json:"status" gorm:"column:status"` // 状态:0-禁用,1-正常
|
||
Type ClientType `json:"type" gorm:"column:type"` // 类型:0-普通,1-官方
|
||
}
|
||
|
||
// ClientSpec 客户端安全规范枚举
|
||
type ClientSpec int
|
||
|
||
const (
|
||
ClientSpecNative ClientSpec = 1 // native
|
||
ClientSpecBrowser ClientSpec = 2 // browser
|
||
ClientSpecWeb ClientSpec = 3 // web
|
||
ClientSpecAPI ClientSpec = 4 // api
|
||
)
|
||
|
||
// ClientStatus 客户端状态枚举
|
||
type ClientStatus int
|
||
|
||
const (
|
||
ClientStatusDisabled ClientStatus = 0 // 禁用
|
||
ClientStatusEnabled ClientStatus = 1 // 正常
|
||
)
|
||
|
||
// ClientType 客户端类型枚举
|
||
type ClientType int
|
||
|
||
const (
|
||
ClientTypeNormal ClientType = 0 // 普通
|
||
ClientTypeOfficial ClientType = 1 // 官方
|
||
)
|