feat: 更新配置文件和模型以支持服务器相关功能

修改MySQL和Redis配置为本地开发环境
在Subscribe类型和模型中添加服务器相关字段
在InviteConfig中添加新配置项
启用ServerModel并修复数据库迁移错误处理
删除无用的运行配置文件
This commit is contained in:
2025-12-28 17:08:24 -08:00
parent 49d59eccb0
commit f26babaa6f
9 changed files with 1114 additions and 24 deletions
+2
View File
@@ -194,6 +194,8 @@ type InviteConfig struct {
FirstPurchasePercentage int64 `yaml:"FirstPurchasePercentage" default:"20"`
FirstYearlyPurchasePercentage int64 `yaml:"FirstYearlyPurchasePercentage" default:"25"`
NonFirstPurchasePercentage int64 `yaml:"NonFirstPurchasePercentage" default:"10"`
OnlyFirstPurchase bool `yaml:"OnlyFirstPurchase" default:"true"`
ReferralPercentage int64 `yaml:"ReferralPercentage" default:"20"`
}
type Telegram struct {
+2
View File
@@ -22,6 +22,8 @@ type Subscribe struct {
Quota int64 `gorm:"type:int;not null;default:0;comment:Quota"`
Nodes string `gorm:"type:varchar(255);comment:Node Ids"`
NodeTags string `gorm:"type:varchar(255);comment:Node Tags"`
ServerGroup string `gorm:"type:varchar(255);comment:Server Group Ids"`
Server string `gorm:"type:varchar(255);comment:Server Ids"`
Show *bool `gorm:"type:tinyint(1);not null;default:0;comment:Show portal page"`
Sell *bool `gorm:"type:tinyint(1);not null;default:0;comment:Sell"`
Sort int64 `gorm:"type:int;not null;default:0;comment:Sort"`
+3 -2
View File
@@ -4,6 +4,7 @@ import (
"context"
"github.com/perfect-panel/server/internal/model/client"
"github.com/perfect-panel/server/internal/model/server"
"github.com/perfect-panel/server/internal/model/node"
"github.com/perfect-panel/server/pkg/device"
@@ -45,7 +46,7 @@ type ServiceContext struct {
OrderModel order.Model
ClientModel client.Model
TicketModel ticket.Model
//ServerModel server.Model
ServerModel server.Model
SystemModel system.Model
CouponModel coupon.Model
PaymentModel payment.Model
@@ -96,7 +97,7 @@ func NewServiceContext(c config.Config) *ServiceContext {
OrderModel: order.NewModel(db, rds),
ClientModel: client.NewSubscribeApplicationModel(db),
TicketModel: ticket.NewModel(db, rds),
//ServerModel: server.NewModel(db, rds),
ServerModel: server.NewModel(db, rds),
SystemModel: system.NewModel(db, rds),
CouponModel: coupon.NewModel(db, rds),
PaymentModel: payment.NewModel(db, rds),
+2
View File
@@ -2003,6 +2003,8 @@ type Subscribe struct {
Quota int64 `json:"quota"`
Nodes []int64 `json:"nodes"`
NodeTags []string `json:"node_tags"`
ServerCount int64 `json:"server_count"`
Server []int64 `json:"server"`
Show bool `json:"show"`
Sell bool `json:"sell"`
Sort int64 `json:"sort"`