feat: 通用授权后台、离线证、Waffo 支付页与仪表盘加强
支持多产品计划展示、LICOFF 离线签发、支付独立配置与调试,以及分析看板;同步更新 README 与集成文档。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
0966375076
commit
8cc2c83f9d
41 files changed
+3177
-332
No files matched your search
@@ -2,14 +2,30 @@ package dto
|
||||
|
||||
// DashboardStats 仪表板统计响应 // Logan.Li
|
||||
type DashboardStats struct {
|
||||
TotalLicenses int64 `json:"total_licenses"`
|
||||
ActiveLicenses int64 `json:"active_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"`
|
||||
MonthlyRevenue float64 `json:"monthly_revenue"`
|
||||
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
|
||||
@@ -51,6 +67,13 @@ type ProductDistribution struct {
|
||||
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"`
|
||||
@@ -61,6 +84,74 @@ type SettingUpdate struct {
|
||||
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"`
|
||||
}
|
||||
|
||||
// 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"`
|
||||
SourceHint string `json:"source_hint"` // db | env | mixed
|
||||
}
|
||||
|
||||
// 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"`
|
||||
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"` // 可选
|
||||
}
|
||||
|
||||
// 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"`
|
||||
|
||||
@@ -28,17 +28,18 @@ type PlanUpdate struct {
|
||||
|
||||
// PlanResponse 定价计划响应 // Logan.Li
|
||||
type PlanResponse struct {
|
||||
ID uint `json:"id"`
|
||||
ProductID uint `json:"product_id"`
|
||||
Name string `json:"name"`
|
||||
PlanType string `json:"plan_type"`
|
||||
Price float64 `json:"price"`
|
||||
Currency string `json:"currency"`
|
||||
Duration int `json:"duration"`
|
||||
MaxDevices int `json:"max_devices"`
|
||||
Features []string `json:"features"`
|
||||
SortOrder int `json:"sort_order"`
|
||||
Status int `json:"status"`
|
||||
ID uint `json:"id"`
|
||||
ProductID uint `json:"product_id"`
|
||||
ProductName string `json:"product_name"`
|
||||
Name string `json:"name"`
|
||||
PlanType string `json:"plan_type"`
|
||||
Price float64 `json:"price"`
|
||||
Currency string `json:"currency"`
|
||||
Duration int `json:"duration"`
|
||||
MaxDevices int `json:"max_devices"`
|
||||
Features []string `json:"features"`
|
||||
SortOrder int `json:"sort_order"`
|
||||
Status int `json:"status"`
|
||||
}
|
||||
|
||||
// OrderResponse 订单响应 // Logan.Li
|
||||
|
||||
@@ -4,7 +4,7 @@ package dto
|
||||
type LicenseCreate struct {
|
||||
CustomerID uint `json:"customer_id" binding:"required"`
|
||||
ProductID uint `json:"product_id" binding:"required"`
|
||||
Duration int `json:"duration" binding:"required"` // 30/90/180/365/730/1095/1825/0(永久)
|
||||
Duration int `json:"duration"` // 30/90/180/365/…/0(永久);0 合法,勿用 binding:required
|
||||
MaxActivations int `json:"max_activations"`
|
||||
IsTrial bool `json:"is_trial"`
|
||||
TrialDays int `json:"trial_days"`
|
||||
@@ -26,6 +26,10 @@ type LicenseRevoke struct {
|
||||
type LicenseResponse struct {
|
||||
ID uint `json:"id"`
|
||||
LicenseKey string `json:"license_key"`
|
||||
LicenseKeyShort string `json:"license_key_short"` // 列表展示用短码,避免 LICOFF 撑爆表格 // Logan.Li
|
||||
Channel string `json:"channel"` // online | offline
|
||||
IsOffline bool `json:"is_offline"`
|
||||
DeviceID string `json:"device_id,omitempty"` // 离线证绑定设备
|
||||
CustomerID uint `json:"customer_id"`
|
||||
CustomerName string `json:"customer_name"`
|
||||
ProductID uint `json:"product_id"`
|
||||
@@ -102,3 +106,31 @@ type ActivationResponse struct {
|
||||
ActivatedAt string `json:"activated_at"`
|
||||
LastSeenAt string `json:"last_seen_at"`
|
||||
}
|
||||
|
||||
// OfflineLicenseCreate 管理端签发离线许可证请求 // Logan.Li
|
||||
type OfflineLicenseCreate struct {
|
||||
DeviceID string `json:"device_id" binding:"required"`
|
||||
Email string `json:"email"`
|
||||
CustomerID uint `json:"customer_id"`
|
||||
CustomerName string `json:"customer_name"`
|
||||
ProductCode string `json:"product_code"`
|
||||
PlanType string `json:"plan_type"` // trial | yearly(禁止 perpetual)
|
||||
DurationDays int `json:"duration_days"` // 1–365,默认 365;trial 上限 180
|
||||
Notes string `json:"notes"`
|
||||
}
|
||||
|
||||
// OfflineLicenseResponse 离线许可证签发结果 // Logan.Li
|
||||
type OfflineLicenseResponse struct {
|
||||
Serial string `json:"serial"`
|
||||
DeviceID string `json:"device_id"`
|
||||
Email string `json:"email,omitempty"`
|
||||
PlanType string `json:"plan_type"`
|
||||
ProductCode string `json:"product_code"`
|
||||
IssuedAt string `json:"issued_at"`
|
||||
ExpiresAt string `json:"expires_at"`
|
||||
Duration int `json:"duration_days"`
|
||||
MaxDevices int `json:"max_devices"`
|
||||
LicenseID uint `json:"license_id"`
|
||||
PublicKey string `json:"public_key_hex"`
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user