基于 opsx-web-lite 框架(Go+Gin+Vue3+Element Plus)构建许可证管理服务器,
业务域参考 Licence 服务器 Web 版。
【后端 - 4层架构】
- 认证:单 Admin 表 + JWT(HS256)
- 核心授权域:Product / Customer / License / Activation
· License 生成/验证/激活/机器绑定/心跳/续期/吊销
· 客户端契约接口:/api/v1/license/{verify,activate,deactivate,heartbeat}
- 定价订单:Plan / Order / 支付网关配置
- 防重复购买:CustomerEntitlement + 幂等支付 webhook + 手动发放
- 分析审计:Dashboard 统计 / Analytics / AuditLog / Setting 管理
【前端】
- Dashboard(ECharts 图表)、产品、客户、License、计划、订单、权益、日志、设置
- 9 个完整 CRUD 业务页面 + 登录/布局
【部署】
- SQLite + 单二进制(//go:embed 嵌入前端)
- 开发:./run.sh start(前端5181/后端9001)
- 生产:./run.sh build && ./run.sh binary start
- 默认账号:admin/admin
Author: Logan.Li
77 lines
2.4 KiB
Go
77 lines
2.4 KiB
Go
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"`
|
|
}
|
|
|
|
// 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"`
|
|
}
|
|
|
|
// 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"`
|
|
}
|
|
|
|
// 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"`
|
|
CreatedAt string `json:"created_at"`
|
|
}
|