feat:Rock刷新去UID拦截,新增绑定错误自动刷新与使用/绑定超时预警
This commit is contained in:
@@ -36,33 +36,35 @@ const (
|
||||
|
||||
// RockConfig 平台配置项
|
||||
type RockConfig struct {
|
||||
ID uint `gorm:"primaryKey;default:1" json:"id"`
|
||||
AutoDeliveryEnabled bool `gorm:"not null;default:true" json:"auto_delivery_enabled"` // 全局自动发货总开关
|
||||
BaseURL string `gorm:"size:255;not null;default:'https://0666.pro'" json:"base_url"` // 默认值见 RockDefaultBaseURL
|
||||
BearerToken string `gorm:"type:text;not null;default:''" json:"bearer_token"`
|
||||
LoginUsername string `gorm:"size:128;not null;default:''" json:"login_username"`
|
||||
LoginPasswordCiphertext string `gorm:"type:text;not null;default:''" json:"-"`
|
||||
LoginPasswordSet bool `gorm:"-" json:"login_password_set"`
|
||||
LastTokenRefreshAt *time.Time `json:"last_token_refresh_at,omitempty"`
|
||||
LastTokenError string `gorm:"type:text;not null;default:''" json:"last_token_error,omitempty"`
|
||||
Username string `gorm:"size:128;not null;default:''" json:"username"`
|
||||
Points float64 `gorm:"type:numeric(12,2);not null;default:0.00" json:"points"`
|
||||
MinPointsWarning float64 `gorm:"type:numeric(12,2);not null;default:1050.00" json:"min_points_warning"`
|
||||
BlackTokenCost float64 `gorm:"type:numeric(12,2);not null;default:20.00" json:"black_token_cost"`
|
||||
TokenWarningStock int `gorm:"not null;default:10" json:"token_warning_stock"`
|
||||
UsingWarnDays int `gorm:"not null;default:3" json:"using_warn_days"` // 使用中超过 N 天橙色预警
|
||||
UsingDangerDays int `gorm:"not null;default:5" json:"using_danger_days"` // 使用中超过 N 天红色预警
|
||||
AutoPurchaseEnabled bool `gorm:"not null;default:false" json:"auto_purchase_enabled"`
|
||||
AutoPurchaseCount int `gorm:"not null;default:50" json:"auto_purchase_count"`
|
||||
PurchaseCooldownMinutes int `gorm:"not null;default:10" json:"purchase_cooldown_minutes"`
|
||||
LastPurchasedAt *time.Time `json:"last_purchased_at"`
|
||||
LastAttemptAt *time.Time `json:"last_attempt_at,omitempty"` // 最近一次采购尝试(成功/失败)时间,用于失败冷却
|
||||
LastAutoAttemptAt *time.Time `json:"last_auto_attempt_at,omitempty"` // 最近一次自动补货尝试时间,自动冷却只认这个
|
||||
LastError string `gorm:"type:text;not null;default:''" json:"last_error"` // 最近一次补货/打包错误,成功后清空
|
||||
LastErrorAt *time.Time `json:"last_error_at,omitempty"`
|
||||
LastHeartbeatAt *time.Time `json:"last_heartbeat_at"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
ID uint `gorm:"primaryKey;default:1" json:"id"`
|
||||
AutoDeliveryEnabled bool `gorm:"not null;default:true" json:"auto_delivery_enabled"` // 全局自动发货总开关
|
||||
BaseURL string `gorm:"size:255;not null;default:'https://0666.pro'" json:"base_url"` // 默认值见 RockDefaultBaseURL
|
||||
BearerToken string `gorm:"type:text;not null;default:''" json:"bearer_token"`
|
||||
LoginUsername string `gorm:"size:128;not null;default:''" json:"login_username"`
|
||||
LoginPasswordCiphertext string `gorm:"type:text;not null;default:''" json:"-"`
|
||||
LoginPasswordSet bool `gorm:"-" json:"login_password_set"`
|
||||
LastTokenRefreshAt *time.Time `json:"last_token_refresh_at,omitempty"`
|
||||
LastTokenError string `gorm:"type:text;not null;default:''" json:"last_token_error,omitempty"`
|
||||
Username string `gorm:"size:128;not null;default:''" json:"username"`
|
||||
Points float64 `gorm:"type:numeric(12,2);not null;default:0.00" json:"points"`
|
||||
MinPointsWarning float64 `gorm:"type:numeric(12,2);not null;default:1050.00" json:"min_points_warning"`
|
||||
BlackTokenCost float64 `gorm:"type:numeric(12,2);not null;default:20.00" json:"black_token_cost"`
|
||||
TokenWarningStock int `gorm:"not null;default:10" json:"token_warning_stock"`
|
||||
UsingWarnDays int `gorm:"not null;default:3" json:"using_warn_days"` // 使用中超过 N 天橙色预警
|
||||
UsingDangerDays int `gorm:"not null;default:5" json:"using_danger_days"` // 使用中超过 N 天红色预警
|
||||
BoundWarnDays int `gorm:"not null;default:2" json:"bound_warn_days"` // 已绑定超过 N 天预警
|
||||
AutoRefreshMismatchEnabled bool `gorm:"not null;default:false" json:"auto_refresh_mismatch_enabled"` // 绑定错误自动刷新
|
||||
AutoPurchaseEnabled bool `gorm:"not null;default:false" json:"auto_purchase_enabled"`
|
||||
AutoPurchaseCount int `gorm:"not null;default:50" json:"auto_purchase_count"`
|
||||
PurchaseCooldownMinutes int `gorm:"not null;default:10" json:"purchase_cooldown_minutes"`
|
||||
LastPurchasedAt *time.Time `json:"last_purchased_at"`
|
||||
LastAttemptAt *time.Time `json:"last_attempt_at,omitempty"` // 最近一次采购尝试(成功/失败)时间,用于失败冷却
|
||||
LastAutoAttemptAt *time.Time `json:"last_auto_attempt_at,omitempty"` // 最近一次自动补货尝试时间,自动冷却只认这个
|
||||
LastError string `gorm:"type:text;not null;default:''" json:"last_error"` // 最近一次补货/打包错误,成功后清空
|
||||
LastErrorAt *time.Time `json:"last_error_at,omitempty"`
|
||||
LastHeartbeatAt *time.Time `json:"last_heartbeat_at"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
func (RockConfig) TableName() string {
|
||||
|
||||
Reference in New Issue
Block a user