package dto // DashboardStats 仪表板统计响应 // Logan.Li type DashboardStats struct { TotalLicenses int64 `json:"total_licenses"` ActiveLicenses int64 `json:"active_licenses"` ExpiredLicenses int64 `json:"expired_licenses"` OfflineLicenses int64 `json:"offline_licenses"` OnlineLicenses int64 `json:"online_licenses"` NewThisMonth int64 `json:"new_this_month"` ExpiringSoon int64 `json:"expiring_soon"` TotalCustomers int64 `json:"total_customers"` TotalProducts int64 `json:"total_products"` OnlineDevices int64 `json:"online_devices"` // 当前在线用户/设备(5 分钟心跳) MonthlyRevenue float64 `json:"monthly_revenue"` TotalRevenue float64 `json:"total_revenue"` } // GeoDistribution 地理/网络分布(基于激活 IP / device_info) // Logan.Li type GeoDistribution struct { Region string `json:"region"` Count int64 `json:"count"` } // PlatformDistribution 客户端形态分布(web / pc / mobile / unknown) // Logan.Li type PlatformDistribution struct { Platform string `json:"platform"` Count int64 `json:"count"` } // ExpiringLicenseItem 即将到期 License // Logan.Li type ExpiringLicenseItem struct { ID uint `json:"id"` LicenseKey string `json:"license_key"` CustomerName string `json:"customer_name"` ProductName string `json:"product_name"` EndDate string `json:"end_date"` DaysLeft int `json:"days_left"` } // RecentActivityItem 最近活动 // Logan.Li type RecentActivityItem struct { ID uint `json:"id"` Username string `json:"username"` Action string `json:"action"` TargetType string `json:"target_type"` TargetName string `json:"target_name"` Detail string `json:"detail"` CreatedAt string `json:"created_at"` } // LicenseGrowthPoint License 增长趋势点 // Logan.Li type LicenseGrowthPoint struct { Date string `json:"date"` Count int64 `json:"count"` } // RevenuePoint 收入趋势点 // Logan.Li type RevenuePoint struct { Period string `json:"period"` Amount float64 `json:"amount"` } // ProductDistribution 产品分布 // Logan.Li type ProductDistribution struct { ProductName string `json:"product_name"` Count int64 `json:"count"` } // LicenseGrowthDetailPoint License 增长明细(累计 + 当月新增) // Logan.Li type LicenseGrowthDetailPoint struct { Date string `json:"date"` Cumulative int64 `json:"cumulative"` Created int64 `json:"created"` } // SettingUpdate 更新系统设置请求 // Logan.Li type SettingUpdate struct { SystemName *string `json:"system_name"` DefaultDuration *int `json:"default_duration"` DefaultMaxActivations *int `json:"default_max_activations"` ExpireReminderDays *int `json:"expire_reminder_days"` APIRateLimit *int `json:"api_rate_limit"` LogRetentionDays *int `json:"log_retention_days"` } // WaffoProductMapping 计划 key → Waffo Product ID(前端 Payments 可扩展表格) // Logan.Li type WaffoProductMapping struct { PlanKey string `json:"plan_key"` Label string `json:"label,omitempty"` ProductID string `json:"product_id"` Currency string `json:"currency,omitempty"` // 如 CNY / USD,空则用全局默认 // Logan.Li } // WaffoSettingsResponse 管理端 Waffo 配置(私钥不回显) // Logan.Li type WaffoSettingsResponse struct { Enabled bool `json:"enabled"` MerchantID string `json:"merchant_id"` StoreID string `json:"store_id"` StoreSlug string `json:"store_slug"` Environment string `json:"environment"` // test | live SandboxMode bool `json:"sandbox_mode"` Currency string `json:"currency"` ProductID string `json:"product_id"` ProductIDYearly string `json:"product_id_yearly"` ProductIDPerpetual string `json:"product_id_perpetual"` ProductIDs map[string]string `json:"product_ids"` // 可扩展 plan_type → PROD_xxx // Logan.Li ProductMappings []WaffoProductMapping `json:"product_mappings"` // 与前端表格对齐 // Logan.Li SuccessURL string `json:"success_url"` WebhookURL string `json:"webhook_url"` PrivateKeyConfigured bool `json:"private_key_configured"` PrivateKeyByEnv map[string]bool `json:"private_key_configured_by_env"` Profiles map[string]WaffoEnvUI `json:"profiles"` // test/live 隔离的映射预览 // Logan.Li SourceHint string `json:"source_hint"` // db | env | mixed } // WaffoEnvUI 单环境前端预览(无私钥) // Logan.Li type WaffoEnvUI struct { ProductMappings []WaffoProductMapping `json:"product_mappings"` ProductID string `json:"product_id"` ProductIDYearly string `json:"product_id_yearly"` ProductIDPerpetual string `json:"product_id_perpetual"` PrivateKeyConfigured bool `json:"private_key_configured"` } // WaffoSettingsUpdate 管理端更新 Waffo 配置;private_key 空=保留原值 // Logan.Li type WaffoSettingsUpdate struct { Enabled *bool `json:"enabled"` MerchantID string `json:"merchant_id"` StoreID string `json:"store_id"` StoreSlug string `json:"store_slug"` Environment string `json:"environment"` // test | live | prod Currency string `json:"currency"` CurrencyYearly string `json:"currency_yearly"` CurrencyPerpetual string `json:"currency_perpetual"` ProductID string `json:"product_id"` ProductIDYearly string `json:"product_id_yearly"` ProductIDPerpetual string `json:"product_id_perpetual"` ProductIDs map[string]string `json:"product_ids"` // 可扩展映射;与 yearly/perpetual 合并 // Logan.Li ProductMappings []WaffoProductMapping `json:"product_mappings"` // 前端表格主数据源 // Logan.Li SuccessURL string `json:"success_url"` PrivateKey string `json:"private_key"` // 仅写入;GET 永不返回 ClearPrivateKey bool `json:"clear_private_key"` } // WaffoDebugRequest 用当前配置探测 create-session(可覆盖 plan/product) // Logan.Li type WaffoDebugRequest struct { PlanType string `json:"plan_type"` // yearly | perpetual | …,默认 yearly ProductID string `json:"product_id"` // 可选覆盖 BuyerEmail string `json:"buyer_email"` // 可选 Environment string `json:"environment"` // 可选:用页面当前环境覆盖 DB ProductIDYearly string `json:"product_id_yearly"` ProductIDPerpetual string `json:"product_id_perpetual"` ProductMappings []WaffoProductMapping `json:"product_mappings"` Currency string `json:"currency"` CurrencyYearly string `json:"currency_yearly"` CurrencyPerpetual string `json:"currency_perpetual"` } // WaffoDebugResponse 调试结果摘要(绝不含私钥) // Logan.Li type WaffoDebugResponse struct { OK bool `json:"ok"` AuthMode string `json:"auth_mode"` // api_key | store_slug | none Environment string `json:"environment"` PlanType string `json:"plan_type"` ProductIDUsed string `json:"product_id_used"` HTTPStatus int `json:"http_status,omitempty"` SessionID string `json:"session_id,omitempty"` CheckoutURLHost string `json:"checkout_url_host,omitempty"` // 仅 host,避免整链噪音 ErrorSummary string `json:"error_summary,omitempty"` PrivateKeyPresent bool `json:"private_key_present"` MerchantIDPresent bool `json:"merchant_id_present"` StoreSlugPresent bool `json:"store_slug_present"` } // AuditLogResponse 操作日志响应 // Logan.Li type AuditLogResponse struct { ID uint `json:"id"` Username string `json:"username"` Action string `json:"action"` TargetType string `json:"target_type"` TargetID uint `json:"target_id"` TargetName string `json:"target_name"` Detail string `json:"detail"` Result string `json:"result"` IP string `json:"ip"` Location string `json:"location,omitempty"` // IP 归属地(城市库识别) // Logan.Li CreatedAt string `json:"created_at"` }